xturn_cache v0.1.1 Xirsys.XTurn.Cache.Store View Source
Simple caching module with TTL, used by the XTurn TURN server project.
Link to this section Summary
Functions
Add a value by key.
Add multiple key / value's.
Returns a specification to start this module under a supervisor.
Returns the value of a key in an erlang success tuple.
Returns the value of a key or nil if not exists.
Returns the agent state as a raw map.
Returns true if a key exists; otherwise false.
Create a cache context.
Create a cache context with specified TTL.
Create a cache context with specified TTL and onTTL callback.
Returns the number of keys in the cache.
Returns all the keys in the cache.
Removes a key and its value.
Destroys the cache (cleanup).
Not to be called directly. Used by the cache to timeout keys.
Link to this section Functions
Add a value by key.
Returns :ok
Examples
iex> ctx = Xirsys.XTurn.Cache.Store.init()
{:ok, pid()}
iex> Xirsys.XTurn.Cache.Store.append(ctx, {"key", "value"})
:ok
Add multiple key / value's.
Returns :ok
Examples
iex> ctx = Xirsys.XTurn.Cache.Store.init()
{:ok, pid()}
iex> Xirsys.XTurn.Cache.Store.append_items_to_store(ctx, [{"key", "value"}, {"key2", "value2"}])
:ok
Returns a specification to start this module under a supervisor.
See Supervisor
.
Returns the value of a key in an erlang success tuple.
Returns the value of a key or nil if not exists.
Returns the agent state as a raw map.
Returns true if a key exists; otherwise false.
Create a cache context.
Create a cache context with specified TTL.
Create a cache context with specified TTL and onTTL callback.
Returns the number of keys in the cache.
Returns all the keys in the cache.
Removes a key and its value.
Returns :ok
Examples
iex> ctx = Xirsys.XTurn.Cache.Store.init()
{:ok, pid()}
iex> Xirsys.XTurn.Cache.Store.append_item_to_store(ctx, {"key", "value"})
:ok
iex> Xirsys.XTurn.Cache.Store.remove_item_from_store(ctx, "key")
:ok
Destroys the cache (cleanup).
Not to be called directly. Used by the cache to timeout keys.