Named FIFO queues backed by SuperCache ETS partitions.
Works transparently in both local and distributed modes — the
mode is determined by the :cluster option passed to SuperCache.start!/1.
In distributed mode, structural mutations (add, out, get_all) are
routed to the partition's primary node. Reads (peak, count) default
to the local replica and accept :read_mode for stronger consistency.
Example
alias SuperCache.Queue
Queue.add("jobs", :compress)
Queue.add("jobs", :upload)
Queue.count("jobs") # => 2
Queue.peak("jobs") # => :compress
Queue.out("jobs") # => :compress
Queue.get_all("jobs") # => [:upload]
Summary
Functions
Enqueue value into queue_name. Creates the queue if it does not exist.
Return the number of items.
Drain all items (oldest first). Returns [] for an empty queue.
Dequeue and return the front value. Returns default (nil) when empty.
Peek at the front value without removing it.
Functions
Enqueue value into queue_name. Creates the queue if it does not exist.
@spec count( any(), keyword() ) :: non_neg_integer()
Return the number of items.
Options
:read_mode—:local(default),:primary, or:quorum.
Drain all items (oldest first). Returns [] for an empty queue.
Dequeue and return the front value. Returns default (nil) when empty.
Peek at the front value without removing it.
Options
:read_mode—:local(default),:primary, or:quorum.