Class: RedisObj::List

Inherits:
Base
  • Object
show all
Includes:
Enumerable
Defined in:
lib/redis_obj/list.rb

Instance Attribute Summary

Attributes inherited from Base

#key, #redis

Instance Method Summary collapse

Methods inherited from Base

#==, #del_key, #initialize

Constructor Details

This class inherits a constructor from RedisObj::Base

Instance Method Details

#blpop(*args) ⇒ Object



4
5
6
# File 'lib/redis_obj/list.rb', line 4

def blpop *args
  redis.blpop(key,*args)
end

#brpop(*args) ⇒ Object



8
9
10
# File 'lib/redis_obj/list.rb', line 8

def brpop *args
  redis.brpop(key,*args)
end

#brpoplpush(destination, options = {}) ⇒ Object



12
13
14
# File 'lib/redis_obj/list.rb', line 12

def brpoplpush(destination, options = {})
  redis.brpoplpush(key,destination,options)
end

#each(&blk) ⇒ Object



33
34
35
# File 'lib/redis_obj/list.rb', line 33

def each &blk
  to_a.each(&blk)
end

#lenObject Also known as: length, size, count



50
51
52
# File 'lib/redis_obj/list.rb', line 50

def len
  redis.llen(key)
end

#lindex(index) ⇒ Object Also known as: []



16
17
18
# File 'lib/redis_obj/list.rb', line 16

def lindex(index)
  redis.lindex(key,index)
end

#linsert(where, pivot, value) ⇒ Object



21
22
23
# File 'lib/redis_obj/list.rb', line 21

def linsert(where, pivot, value)
  redis.linsert(key,where,pivot,value)
end

#lpopObject Also known as: shift



57
58
59
# File 'lib/redis_obj/list.rb', line 57

def lpop
  redis.lpop(key)
end

#lpush(val) ⇒ Object Also known as: unshift



62
63
64
# File 'lib/redis_obj/list.rb', line 62

def lpush val
  redis.lpush(val)
end

#lpushx(val) ⇒ Object



67
68
69
# File 'lib/redis_obj/list.rb', line 67

def lpushx val
  redis.lpushx(key,val)
end

#lrange(start, stop) ⇒ Object



25
26
27
# File 'lib/redis_obj/list.rb', line 25

def lrange(start, stop)
  redis.lrange(key, start, stop)
end

#lrem(count, value) ⇒ Object



37
38
39
# File 'lib/redis_obj/list.rb', line 37

def lrem(count, value)
  redis.lrem(key, count, value)
end

#lset(index, value) ⇒ Object Also known as: []=



41
42
43
# File 'lib/redis_obj/list.rb', line 41

def lset(index, value)
  redis.lset(key, index, value)
end

#ltrim(start, stop) ⇒ Object



46
47
48
# File 'lib/redis_obj/list.rb', line 46

def ltrim(start, stop)
  redis.ltrim(key, start, stop)
end

#rpopObject Also known as: pop



71
72
73
# File 'lib/redis_obj/list.rb', line 71

def rpop
  redis.rpop(key)
end

#rpoplpush(destination) ⇒ Object



76
77
78
# File 'lib/redis_obj/list.rb', line 76

def rpoplpush destination
  redis.rpoplpush(key, destination)
end

#rpush(val) ⇒ Object Also known as: <<, push



80
81
82
# File 'lib/redis_obj/list.rb', line 80

def rpush val
  redis.rpush(key,val)
end

#rpushx(val) ⇒ Object



86
87
88
# File 'lib/redis_obj/list.rb', line 86

def rpushx val
  redis.rpushx(key,val)
end

#to_aObject



29
30
31
# File 'lib/redis_obj/list.rb', line 29

def to_a
  lrange(0,-1)
end