Sha256: ed6d030f42bb2c2aa95672d374e9b7dd8ddf0aa274a10a06a42e58b88662429e

Contents?: true

Size: 444 Bytes

Versions: 2

Compression:

Stored size: 444 Bytes

Contents

require 'rubygems'
require 'redis'

r = Redis2.new

r.del 'logs'

puts

p "pushing log messages into a LIST"
r.rpush 'logs', 'some log message'
r.rpush 'logs', 'another log message'
r.rpush 'logs', 'yet another log message'
r.rpush 'logs', 'also another log message'

puts
p 'contents of logs LIST'

p r.lrange('logs', 0, -1)

puts
p 'Trim logs LIST to last 2 elements(easy circular buffer)'

r.ltrim('logs', -2, -1)

p r.lrange('logs', 0, -1)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
redis2-namespaced-3.0.7.1 examples/list.rb
redis2-namespaced-3.0.7 examples/list.rb