Sha256: 6ccab7cfc00f7735c746fec6d044606fa0d430c86f6b1f12889f33f83f32b0a6

Contents?: true

Size: 474 Bytes

Versions: 6

Compression:

Stored size: 474 Bytes

Contents

require 'rubygems'
require 'redis'

r = Redis.new

r.delete 'logs'

puts

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

puts
p 'contents of logs LIST'

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

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

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

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

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
adamwiggins-redis-rb-0.1.1 examples/list.rb
vanity-1.3.0 vendor/redis-rb/examples/list.rb
mikeg-vanity-1.3.0 vendor/redis-rb/examples/list.rb
vanity-1.2.0 vendor/redis-rb/examples/list.rb
vanity-1.1.1 vendor/redis-rb/examples/list.rb
vanity-1.1.0 vendor/redis-rb/examples/list.rb