Sha256: 07b296700865eeab2583c7cd911724fbaa88f77d926f9a1c9981e9534e437b17

Contents?: true

Size: 574 Bytes

Versions: 17

Compression:

Stored size: 574 Bytes

Contents

module MessageQueue
  class Kestrel < Base
    def initialize(opts)
      @servers = opts['servers']
    end

    def queue_size(queue)
      size  = 0
      stats = client.stats
      servers.each do |server|
        size += stats[server]["queue_#{queue}_items"].to_i
      end
      size
    end

    def enqueue(queue, data)
      client.set(queue, data)
    end

    def dequeue(queue)
      client.get("#{queue}/open")
    end

    def confirm(queue)
      client.get("#{queue}/close")
    end

    def client
      @client ||= MemCache.new(servers) 
    end
  end
end

Version data entries

17 entries across 17 versions & 5 rubygems

Version Path
Bira-sweat_shop-1.0.0 lib/message_queue/kestrel.rb
famoseagle-sweat_shop-0.7.0 lib/message_queue/kestrel.rb
famoseagle-sweat_shop-0.8.0 lib/message_queue/kestrel.rb
famoseagle-sweat_shop-0.8.1 lib/message_queue/kestrel.rb
famoseagle-sweat_shop-0.8.2 lib/message_queue/kestrel.rb
famoseagle-sweat_shop-1.0.0 lib/message_queue/kestrel.rb
famoseagle-sweat_shop-1.1.0 lib/message_queue/kestrel.rb
famoseagle-sweat_shop-1.2.0 lib/message_queue/kestrel.rb
famoseagle-sweat_shop-1.3.0 lib/message_queue/kestrel.rb
famoseagle-sweat_shop-1.3.1 lib/message_queue/kestrel.rb
sweatshop-1.6.0 lib/message_queue/kestrel.rb
sweatshop-1.5.2 lib/message_queue/kestrel.rb
sa-sweat_shop-1.4.3 lib/message_queue/kestrel.rb
sweatshop-1.5.1 lib/message_queue/kestrel.rb
sweatshop-1.5.0 lib/message_queue/kestrel.rb
sweatshop-1.4.0 lib/message_queue/kestrel.rb
sweat_shop-1.4.0 lib/message_queue/kestrel.rb