All Projects → Asmod4n → mruby-hiredis

Asmod4n / mruby-hiredis

Licence: Apache-2.0 License
mruby bindings for https://github.com/redis/hiredis

Programming Languages

c
50402 projects - #5 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to mruby-hiredis

rcppredis
R interface to Redis using the hiredis library
Stars: ✭ 45 (+275%)
Mutual labels:  redis-client, hiredis
mruby-tflite
MRuby binding for TensorFlow Lite
Stars: ✭ 14 (+16.67%)
Mutual labels:  mruby
jimhttp
A library collection and web microframework
Stars: ✭ 25 (+108.33%)
Mutual labels:  redis-client
grafana-redis-app
Redis Application for @grafana provides Application pages and custom panels for Redis Data Source.
Stars: ✭ 23 (+91.67%)
Mutual labels:  redis-client
cpp redis
C++11 Lightweight Redis client: async, thread-safe, no dependency, pipelining, multi-platform
Stars: ✭ 506 (+4116.67%)
Mutual labels:  redis-client
redis-modules-java
Java client libraries for redis-modules https://redis.io/modules, based on Redisson. https://github.com/redisson/redisson
Stars: ✭ 57 (+375%)
Mutual labels:  redis-client
mruby-esp32
mruby application template for ESP32
Stars: ✭ 81 (+575%)
Mutual labels:  mruby
oxblood
A straightforward Redis Ruby library
Stars: ✭ 23 (+91.67%)
Mutual labels:  redis-client
salad
Asynchronous Scala Redis Client supporting Sentinel and Redis Cluster
Stars: ✭ 14 (+16.67%)
Mutual labels:  redis-client
Redis-Monitoring
Solar power data ingestion and a monitoring dashboard using Redis as a primary database.
Stars: ✭ 16 (+33.33%)
Mutual labels:  redis-client
node-cache-manager-ioredis
Redis store for node-cache-manager using IORedis.
Stars: ✭ 47 (+291.67%)
Mutual labels:  redis-client
redis-developer.github.io
The Home of Redis Developers
Stars: ✭ 28 (+133.33%)
Mutual labels:  redis-client
redistimeseries-py
RedisTimeSeries python client
Stars: ✭ 95 (+691.67%)
Mutual labels:  redis-client
rueidis
A Fast Golang Redis RESP3 client that supports Client Side Caching, Auto Pipelining, Generics OM, RedisJSON, RedisBloom, RediSearch, RedisAI, RedisGears, etc.
Stars: ✭ 422 (+3416.67%)
Mutual labels:  redis-client
StackExchange.Redis-docs-zh-cn
StackExchange.Redis中文使用文档
Stars: ✭ 92 (+666.67%)
Mutual labels:  redis-client
simple redis
Simple and resilient redis client for rust.
Stars: ✭ 21 (+75%)
Mutual labels:  redis-client
vredis
Redis client for V, written in V
Stars: ✭ 43 (+258.33%)
Mutual labels:  redis-client
BeetleX.Redis
A high-performance async/non-blocking redis client components for dotnet core,default data formater json protobuf and messagepack,support ssl
Stars: ✭ 174 (+1350%)
Mutual labels:  redis-client
WeihanLi.Redis
RedisExtensions for StackExchange.Redis, Cache/Redlock/Counter/RateLimiter/Rank/RedisEventBus
Stars: ✭ 46 (+283.33%)
Mutual labels:  redis-client
racompass
An advanced GUI for Redis. Modern. Efficient. Fast. A faster and robust Redis management tool. For developers that need to manage data with confidence.It supports Redis modules now!
Stars: ✭ 26 (+116.67%)
Mutual labels:  redis-client

Build Status

mruby-hiredis

mruby bindings for https://github.com/redis/hiredis

Examples

Connect to the default redis-server

hiredis = Hiredis.new

Connect to a tcp redis-server

hiredis = Hiredis.new("localhost", 6379) #if you leave the port out it defaults to 6379

Connect to a unix redis-server

hiredis = Hiredis.new("/tmp/redis.sock", -1) #set port to -1 so it connects to a unix socket

All Redis Commands are mapped to Ruby Methods, this happens automatically when you connect the first time to a Server.

hiredis["foo"] = "bar"
hiredis["foo"]
hiredis.incr("bar")

If you later on want to add more shortcut methods, because the first Server you connected to is of a lower version than the others, you can call

Hiredis.create_shortcuts(hiredis)

Pipelining

hiredis.queue(:set, "foo", "bar")
hiredis.queue(:get, "foo")
hiredis.bulk_reply

Transactions

hiredis.transaction([:incr, "bar"], [:get, "foo"])

Subscriptions

hiredis.subscribe('channel')

loop do
  puts hiredis.reply
end

Async Client

async = Hiredis::Async.new #(callbacks = Hiredis::Async::Callbacks.new, evloop = RedisAe.new, host_or_path = "localhost", port = 6379)
async.evloop.run_once
async.queue(:set, "foo", "bar")
async.evloop.run_once
async.queue(:get, "foo") {|reply| puts reply}
async.evloop.run_once

Disque

https://github.com/antirez/disque made it mandatory to change the way mruby-hiredis handles status replies, they have been symbols in the past, but are Strings now. This brakes pipelining and transactions for existing applications. Because of that the major version got incremented.

Reply Error Handling

When you get a reply back, you have to check if it is a "Hiredis::ReplyError", this was done so pipelined transactions can complete even if there are errors.

Acknowledgements

This is using code from https://github.com/redis/hiredis

Copyright (c) 2009-2011, Salvatore Sanfilippo Copyright (c) 2010-2011, Pieter Noordhuis

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of Redis nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].