Elixir QLib v0.1.0 QLib.BufferedQueue
BufferedQueue is a simple and buffered abstraction around state.
A BufferedQueue can only store a N maximum of items. The size of BufferedQueue will never exceed the N items. If a BufferedQueue achieve its maximum capacity and a new item has to be inserted, the collection automatically will remove its oldest item.
The default capacity of BufferedQueue is 1000 items. The developers can set the capacity value during the creation of the collection.
Examples
{:ok, q} = BufferedQueue.new 5000 BufferedQueue.push(q, 1) BufferedQueue.pop(q) BufferedQueue.size(q) BufferedQueue.clear(q) BufferedQueue.destroy(q)
Summary
Functions
Removes all the items in the BufferedQueue
Destroy the BufferedQueue
Creates a new empty BufferedQueue with a maximum of capacity
items
Removes and returns the first item in the BufferedQueue
Inserts the item
in the BufferedQueue
Returns the size of the BufferedQueue