class Box::Office::Queue
Constants
- LIMIT
Attributes
name[R]
Public Class Methods
new(name)
click to toggle source
# File lib/box/office/queue.rb, line 11 def initialize(name) @name = name end
Public Instance Methods
clear()
click to toggle source
# File lib/box/office/queue.rb, line 15 def clear with_connection { |conn| conn.del(name) } end
empty?()
click to toggle source
# File lib/box/office/queue.rb, line 23 def empty? length.zero? end
length()
click to toggle source
# File lib/box/office/queue.rb, line 27 def length with_connection { |conn| conn.llen(name) } end
Also aliased as: size
members(limit: LIMIT)
click to toggle source
# File lib/box/office/queue.rb, line 19 def members(limit: LIMIT) with_connection { |conn| conn.lrange(name, 0, limit - 1) } end
push(*msg)
click to toggle source
# File lib/box/office/queue.rb, line 32 def push(*msg) with_connection { |conn| conn.lpush(name, *msg) } end
Also aliased as: <<
remove(msg)
click to toggle source
# File lib/box/office/queue.rb, line 37 def remove(msg) with_connection { |conn| conn.lrem(name, 0, msg) } end
Also aliased as: >>