Routemaster Client v0.3.0 Routemaster.Redis View Source

This is the main interface to Redis, and it implements two functions to get a reference to the two Redis stores: the persistent data store and the cache store.

Supported Redis commands should be implemented as public functions of this module, and will automaticallt be available on both clients.

Link to this section Summary

Functions

Returns a redis connection to the cache Redis store. The returned term can be used to issue Redis commands

Returns a redis connection to the persistent Redis store. The returned term can be used to issue Redis commands

Deserializes valid binary data (External Term Format) back into an Elixir term

Serializes an Elixir term into a binary using Erlang’s External Term Format

Link to this section Functions

Link to this function cache() View Source
cache() :: Routemaster.Redis.Cache

Returns a redis connection to the cache Redis store. The returned term can be used to issue Redis commands.

iex> Routemaster.Redis.cache.set(:foo, "bar")
{:ok, "OK"}
iex> Routemaster.Redis.cache.get(:foo)
{:ok, "bar"}
Link to this function data() View Source
data() :: Routemaster.Redis.Data

Returns a redis connection to the persistent Redis store. The returned term can be used to issue Redis commands.

iex> Routemaster.Redis.data.set(:foo, "bar")
{:ok, "OK"}
iex> Routemaster.Redis.data.get(:foo)
{:ok, "bar"}
Link to this function deserialize(data) View Source
deserialize(binary()) :: term()

Deserializes valid binary data (External Term Format) back into an Elixir term.

Link to this function serialize(term) View Source
serialize(term()) :: binary()

Serializes an Elixir term into a binary using Erlang’s External Term Format.

The returned binary can be safely stored into Redis and deserialized later.