Skip to content

Latest commit

 

History

History
42 lines (29 loc) · 731 Bytes

README.md

File metadata and controls

42 lines (29 loc) · 731 Bytes

Turnpike

turnpike

Turnpike is a minimal Redis-backed FIFO queue in Ruby.

Usage

Push and pop:

q = Turnpike.call('queue name')
q.push('foo', 'bar', 'baz', 'qux') # => 4
q.pop # => 'foo'

Pop multiple items:

q.pop(2) # => ['bar', 'baz']

Push payload to the front of the queue:

q.unshift('foo') # => 2
q.pop # => 'foo'

Use a queue with set-like properties to ensure uniqueness of queued items:

q = Turnpike.call('queue name', unique: true)
q.push('foo', 'bar') # => 2
q.push('bar') # => 2
q.pop(3) # => ['foo', 'bar']

Turnpike requires Ruby 2.0 and Redis 2.6 or higher.