Sha256: 870e2ceeeeb7432407a9bfbf926bac9c64c5ea8b8f5ed5c4dcebd32ed579a22b
Contents?: true
Size: 760 Bytes
Versions: 1
Compression:
Stored size: 760 Bytes
Contents
module RedisDatapump class ValueExtractor VALUE_MAP = { 'string' => proc {|client, key| client.get(key)}, 'hash' => proc {|client, key| client.hgetall(key)}, 'set' => proc {|client, key| client.smembers(key)}, 'list' => proc {|client, key| client.lrange key, 0, -1 }, 'zset' => proc {|client, key| client.zrange(key, 0, -1, :with_scores => true) }, } def initialize redis_client, key @redis_client = redis_client @key = key end def content return @content if @content type = @redis_client.type(@key) @content = { key: @key, type: type, value: VALUE_MAP[type].call(@redis_client, @key), ttl: @redis_client.pttl(@key), } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
redis-datapump-0.1.0.alpha1 | lib/redis-datapump/value_extractor.rb |