Module: Wurk::RedisClientAdapter::CompatMethods
- Defined in:
- lib/wurk/redis_client_adapter.rb
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”, …)`.
51 52 53 54 55 56 |
# File 'lib/wurk/redis_client_adapter.rb', line 51 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 @client.call(*args, &) end |
Instance Method Details
#evalsha(sha, keys, argv) ⇒ Object
29 30 31 |
# File 'lib/wurk/redis_client_adapter.rb', line 29 def evalsha(sha, keys, argv) @client.call('EVALSHA', sha, keys.size, *keys, *argv) end |
#info ⇒ Object
25 26 27 |
# File 'lib/wurk/redis_client_adapter.rb', line 25 def info @client.call('INFO') { |i| i.lines(chomp: true).map { |l| l.split(':', 2) }.select { |l| l.size == 2 }.to_h } end |