Kalevala.Cache behaviour (kalevala v0.1.0) View Source

GenServer for caching in game resources

Example

defmodule Kantele.World.Items do
  use Kalevala.Cache
end
iex> Kalevala.Items.put("sammatti:sword", %Item{})
iex> Kalevala.Items.get("sammatti:sword")
%Item{}

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Get a value out of the cache

Get a list of all keys in a table

Put a new value into the cache

Callbacks

Called after the cache is booted

Link to this section Types

Specs

t() :: %Kalevala.Cache{callback_module: term(), ets_key: term()}

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Get a value out of the cache

Get a list of all keys in a table

Link to this function

keys(current_key, accumulator, ets_key)

View Source

Put a new value into the cache

Link to this section Callbacks

Specs

initialize(t()) :: :ok

Called after the cache is booted

A chance to warm the cache before accepting outside updates.