class Rudis::List

Public Instance Methods

<<(val)
Alias for: rpush
>>(val)
Alias for: lpush
[](thing) click to toggle source
# File lib/rudis/structures/list.rb, line 29
def [](thing)
  if thing.is_a? Fixnum
    index thing
  elsif thing.is_a? Range
    range thing
  end
end
[]=(i, val)
Alias for: set
all() click to toggle source
# File lib/rudis/structures/list.rb, line 24
def all
  range 0..-1
end
Also aliased as: to_a
count()
Alias for: len
empty?() click to toggle source
# File lib/rudis/structures/list.rb, line 10
def empty?
  len == 0
end
index(i) click to toggle source
# File lib/rudis/structures/list.rb, line 14
def index(i)
  type.get(redis.lindex(key, i.to_i))
end
len() click to toggle source
# File lib/rudis/structures/list.rb, line 3
def len
  redis.llen(key)
end
Also aliased as: length, size, count
length()
Alias for: len
lpop() click to toggle source
# File lib/rudis/structures/list.rb, line 60
def lpop
  e = redis.lpop(key)
  e && type.get(e)
end
Also aliased as: shift
lpush(val) click to toggle source
# File lib/rudis/structures/list.rb, line 54
def lpush(val)
  redis.lpush(key, type.put(val))
end
Also aliased as: unshift, >>
pop()
Alias for: rpop
push(val)
Alias for: rpush
range(range) click to toggle source
# File lib/rudis/structures/list.rb, line 18
def range(range)
  redis.lrange(key, range.first.to_i, range.last.to_i).map do |e|
    type.get(e)
  end
end
rpop() click to toggle source
# File lib/rudis/structures/list.rb, line 48
def rpop
  e = redis.rpop(key)
  e && type.get(e)
end
Also aliased as: pop
rpush(val) click to toggle source
# File lib/rudis/structures/list.rb, line 42
def rpush(val)
  redis.rpush(key, type.put(val))
end
Also aliased as: push, <<
set(i, val) click to toggle source
# File lib/rudis/structures/list.rb, line 37
def set(i, val)
  redis.lset(key, i.to_i, type.put(val))
end
Also aliased as: []=
shift()
Alias for: lpop
size()
Alias for: len
to_a()
Alias for: all
trim(range) click to toggle source
# File lib/rudis/structures/list.rb, line 66
def trim(range)
  redis.trim(key, range.first.to_i, range.last.to_i)
end
Also aliased as: trim!
trim!(range)
Alias for: trim
unshift(val)
Alias for: lpush