exhtml v0.3.1 Exhtml.Table

Exhtml.Table provides a place to set and get HTML contents by slug.

Examples:

iex> {:ok, pid} = Exhtml.Table.start_link []
...> Exhtml.Table.set(pid, :foo, :bar)
:ok
...> Exhtml.Table.get(pid, :foo)
:bar

Summary

Functions

Gets content of the slug from the store

Removes content of the slug from the store

Sets content of the slug into the store

Starts a Exhtml.Table process

Types

server()
server() :: GenServer.server
slug()
slug() :: Exhtml.slug

Functions

get(server, slug)
get(server, slug) :: any

Gets content of the slug from the store.

  • server - PID or name of the server
  • slug - key of the content
rm(server, slug)
rm(server, slug) :: :ok

Removes content of the slug from the store.

  • server - PID or name of the server
  • slug - key of the content
set(server, slug, content)
set(server, slug, any) :: :ok

Sets content of the slug into the store.

  • server - PID or name of the server
  • slug - key of the content
  • content - the content for the slug

Examples:

iex> {:ok, pid} = Exhtml.Table.start_link []
...> Exhtml.Table.set(pid, :foo, :bar)
:ok
iex> Exhtml.Table.get(pid, :foo)
:bar
start_link(opts)
start_link([{:key, any}]) :: {:ok, pid} | {:error, any}

Starts a Exhtml.Table process.

  • opts - options for starting the process:

    • data_dir indicates which path the data will be persited in.
    • data_nodes indicates which nodes will hold persisted data. Other nodes will only hold data in memories.

Returns {:ok, pid} if succeed, {:error, reason} otherwise.