class DRbQueue::Store::Redis

Attributes

redis[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/drb_queue/store/redis.rb, line 7
def initialize(options = {})
  @redis = ::Redis::Namespace.new(:DRbQueue, :redis => options.fetch(:redis, lambda { ::Redis.new }).call)
end

Public Instance Methods

each_persisted_work() { |serialized_work| ... } click to toggle source
# File lib/drb_queue/store/redis.rb, line 15
def each_persisted_work
  return enum_for(:each_persisted_work) unless block_given?

  while serialized_work = redis.lpop(persistence_key)
    yield(serialized_work)
  end
end
persist(work) click to toggle source
# File lib/drb_queue/store/redis.rb, line 11
def persist(work)
  redis.rpush(persistence_key, work.serialize)
end

Private Instance Methods

persistence_key() click to toggle source
# File lib/drb_queue/store/redis.rb, line 26
def persistence_key
  'persisted:work'
end