]> git.saurik.com Git - redis.git/blame - client-libraries/ruby/examples/list.rb
Redis-rb sync
[redis.git] / client-libraries / ruby / examples / list.rb
CommitLineData
ed9b544e 1require 'rubygems'
2require 'redis'
3
4r = Redis.new
5
6r.delete 'logs'
7
8puts
9
10p "pushing log messages into a LIST"
11r.push_tail 'logs', 'some log message'
12r.push_tail 'logs', 'another log message'
13r.push_tail 'logs', 'yet another log message'
14r.push_tail 'logs', 'also another log message'
15
16puts
17p 'contents of logs LIST'
18
19p r.list_range('logs', 0, -1)
20
21puts
22p 'Trim logs LIST to last 2 elements(easy circular buffer)'
23
24r.list_trim('logs', -2, -1)
25
26p r.list_range('logs', 0, -1)