Module: Wurk::RedisClientAdapter::CompatMethods
- Defined in:
- lib/wurk/redis_client_adapter.rb
Overview
Every method here dispatches through call rather than @client.call so
the round-trip odometer below sees method-style commands too — a host
block doing conn.sadd(...) then conn.lpush(...) has to be as
replay-protected as one written with conn.call. On the pipeline
decorator call is the same buffered forward it always was.
Constant Summary collapse
- USED_COMMANDS =
The Redis commands Sidekiq itself uses — defined eagerly so the common ones skip method_missing. Same list as upstream.
%w[bitfield bitfield_ro del exists expire flushdb get hdel hget hgetall hincrby hlen hmget hset hsetnx incr incrby lindex llen lmove lpop lpush lrange lrem mget mset ping pttl publish rpop rpush sadd scard script set sismember smembers srem ttl type unlink zadd zcard zincrby zrange zrem zremrangebyrank zremrangebyscore].freeze
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args) ⇒ Object (private)
conn.hmset(...) instead of redis-client's native conn.call("hmset", ...).
56 57 58 59 60 61 |
# File 'lib/wurk/redis_client_adapter.rb', line 56 def method_missing(*args, &) if DEPRECATED_COMMANDS.include?(args.first) warn("[sidekiq#5788] Redis has deprecated the `#{args.first}` command, called at #{caller(1..1)}") end call(*args, &) end |
Instance Method Details
#evalsha(sha, keys, argv) ⇒ Object
34 35 36 |
# File 'lib/wurk/redis_client_adapter.rb', line 34 def evalsha(sha, keys, argv) call('EVALSHA', sha, keys.size, *keys, *argv) end |
#info ⇒ Object
30 31 32 |
# File 'lib/wurk/redis_client_adapter.rb', line 30 def info call('INFO') { |i| i.lines(chomp: true).map { |l| l.split(':', 2) }.select { |l| l.size == 2 }.to_h } end |