Module: Redis::Plus

Included in:
Redis
Defined in:
lib/redis/plus.rb,
lib/redis/plus/version.rb

Constant Summary collapse

VERSION =
"0.0.2"

Instance Method Summary collapse

Instance Method Details

#lgetall(key) ⇒ Object



6
7
8
# File 'lib/redis/plus.rb', line 6

def lgetall(key)
  lrange(key, 0, -1)
end

#lstrlen(key, index) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/redis/plus.rb', line 10

def lstrlen(key, index)
  command = <<-LUA
local v = redis.pcall('lrange',KEYS[1],ARGV[1],ARGV[1])
if v.err then
  return v
else
  return v[1] and string.len(v[1])
end
LUA
  self.eval(command, [key], [index]) || 0
end