Module: RedisPrescription::Adapters::Redis

Defined in:
lib/redis_prescription/adapters/redis.rb

Overview

redis-rb adapter

Class Method Summary collapse

Class Method Details

.adapts?(redis) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/redis_prescription/adapters/redis.rb', line 10

def adapts?(redis)
  defined?(::Redis) && redis.is_a?(::Redis)
end

.eval(redis, script, keys, argv) ⇒ Object



14
15
16
17
18
# File 'lib/redis_prescription/adapters/redis.rb', line 14

def eval(redis, script, keys, argv)
  redis.eval(script, keys, argv)
rescue ::Redis::CommandError => e
  raise CommandError, e.message
end

.evalsha(redis, digest, keys, argv) ⇒ Object



20
21
22
23
24
# File 'lib/redis_prescription/adapters/redis.rb', line 20

def evalsha(redis, digest, keys, argv)
  redis.evalsha(digest, keys, argv)
rescue ::Redis::CommandError => e
  raise CommandError, e.message
end