CarCache.Clock (CarCache v0.1.1) View Source

Data structure representing a "CLOCK".

This implementation uses a circular zipper list to track the clock hand and an ETS table to store the data (and for quick lookups.)

Link to this section Summary

Functions

Insert a new key/value behind the clock hand

Check if the clock contains a given key

Return a new/empty Clock

Pop the next value after the clock hand

Link to this section Types

Specs

t() :: %CarCache.Clock{
  czl: CarCache.CircularZipperList.t(),
  data_table: :ets.tid(),
  name: atom(),
  size: non_neg_integer()
}

Link to this section Functions

Link to this function

insert(clock, key, value)

View Source

Specs

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

Insert a new key/value behind the clock hand

Specs

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

Check if the clock contains a given key

Link to this function

new(name, data_table, opts \\ [])

View Source

Specs

new(atom(), :ets.tid(), Keyword.t()) :: t()

Return a new/empty Clock

Specs

pop(t()) :: {any(), any(), 0 | 1, t()}

Pop the next value after the clock hand