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

GenServer for caching in game resources

example

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

Callbacks

Called after the cache is booted

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

Link to this section Types

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

Link to this section Callbacks

@callback initialize(t()) :: :ok

Called after the cache is booted

A chance to warm the cache before accepting outside updates.

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