Module: RedisPrescription::Adapters::RedisClient
- Defined in:
- lib/redis_prescription/adapters/redis_client.rb
Overview
redis-client adapter
Class Method Summary collapse
- .adapts?(redis) ⇒ Boolean
- .eval(redis, script, keys, argv) ⇒ Object
- .evalsha(redis, digest, keys, argv) ⇒ Object
Class Method Details
.adapts?(redis) ⇒ Boolean
10 11 12 13 14 15 |
# File 'lib/redis_prescription/adapters/redis_client.rb', line 10 def adapts?(redis) return true if defined?(::RedisClient) && redis.is_a?(::RedisClient) return true if defined?(::RedisClient::Decorator::Client) && redis.is_a?(::RedisClient::Decorator::Client) false end |
.eval(redis, script, keys, argv) ⇒ Object
17 18 19 20 21 |
# File 'lib/redis_prescription/adapters/redis_client.rb', line 17 def eval(redis, script, keys, argv) redis.call("EVAL", script, keys.size, *keys, *argv) rescue ::RedisClient::CommandError => e raise CommandError, e. end |
.evalsha(redis, digest, keys, argv) ⇒ Object
23 24 25 26 27 |
# File 'lib/redis_prescription/adapters/redis_client.rb', line 23 def evalsha(redis, digest, keys, argv) redis.call("EVALSHA", digest, keys.size, *keys, *argv) rescue ::RedisClient::CommandError => e raise CommandError, e. end |