View Source CMS.CacheServer (cms v0.11.1)
For caching results in an ETS table. A single instance of this GenServer is started automatically.
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Deletes a table if it exists. Returns :ok
or {:error, :no_table}
.
Fetches a value from the cache. Returns one of the following
Creates or replaces zero or more tables.
Returns a list of ETS table names managed by the cache.
Fetches all values from the table. Returns {:ok, values}
or {:error, :no_table}
.
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Deletes a table if it exists. Returns :ok
or {:error, :no_table}
.
examples
Examples
iex> delete_table(:nonexistent_table)
{:error, :no_table}
Fetches a value from the cache. Returns one of the following
{:ok, value}
if the item is found{:error, :no_table}
if the table doesn't exist{:error, :not_found}
if the table exists but doesn't contain the specified key
Creates or replaces zero or more tables.
examples
Examples
iex> put_tables(table_1: [{"key", "value"}], table_2: %{"key" => "value"})
:ok
Returns a list of ETS table names managed by the cache.
Fetches all values from the table. Returns {:ok, values}
or {:error, :no_table}
.