Sha256: b3894411e369b4ff83a602979290730a2d6a7e46d6bd4564f9b8d7afc8c8f6eb

Contents?: true

Size: 443 Bytes

Versions: 103

Compression:

Stored size: 443 Bytes

Contents

require 'rubygems'
require 'redis'

r = Redis.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

103 entries across 101 versions & 16 rubygems

Version Path
remq-0.0.3 vendor/bundle/gems/redis-3.0.2/examples/list.rb
classiccms-0.6.9 vendor/bundle/gems/redis-2.2.2/examples/list.rb
classiccms-0.6.8 vendor/bundle/gems/redis-2.2.2/examples/list.rb
classiccms-0.6.7 vendor/bundle/gems/redis-2.2.2/examples/list.rb
classiccms-0.6.6 vendor/bundle/gems/redis-2.2.2/examples/list.rb
classiccms-0.6.5 vendor/bundle/gems/redis-2.2.2/examples/list.rb
classiccms-0.6.4 vendor/bundle/gems/redis-2.2.2/examples/list.rb
classiccms-0.6.3 vendor/bundle/gems/redis-2.2.2/examples/list.rb
classiccms-0.6.2 vendor/bundle/gems/redis-2.2.2/examples/list.rb
classiccms-0.6.1 vendor/bundle/gems/redis-2.2.2/examples/list.rb
redis-3.0.2 examples/list.rb
classiccms-0.6.0 vendor/bundle/gems/redis-2.2.2/examples/list.rb
classiccms-0.5.17 vendor/bundle/gems/redis-2.2.2/examples/list.rb
classiccms-0.5.16 vendor/bundle/gems/redis-2.2.2/examples/list.rb
classiccms-0.5.15 vendor/bundle/gems/redis-2.2.2/examples/list.rb
classiccms-0.5.14 vendor/bundle/gems/redis-2.2.2/examples/list.rb
classiccms-0.5.13 vendor/bundle/gems/redis-2.2.2/examples/list.rb
classiccms-0.5.12 vendor/bundle/gems/redis-2.2.2/examples/list.rb
classiccms-0.5.11 vendor/bundle/gems/redis-2.2.2/examples/list.rb
classiccms-0.5.10 vendor/bundle/gems/redis-2.2.2/examples/list.rb