CarCache.LRU (CarCache v0.1.1) View Source

Datastructure to represent a LRU list.

The structure is approximated with the :queue module.

It is O(1) complexity for most operations with the exception of member/2

Link to this section Summary

Functions

Drop the the item at the head (the item that has been in the list the longest) of the list

Insert an item at the tail of the list

Check if the given key is a membor of the list

Return a new/empty LRU list

Link to this section Types

Specs

t() :: %CarCache.LRU{queue: :queue.queue(), size: non_neg_integer()}

Link to this section Functions

Specs

drop(t()) :: t()

Drop the the item at the head (the item that has been in the list the longest) of the list

Specs

insert(t(), any()) :: t()

Insert an item at the tail of the list

Specs

member?(t(), any()) :: boolean()

Check if the given key is a membor of the list

Specs

new() :: t()

Return a new/empty LRU list