avrora v0.1.0-beta Avrora.Storage.Memory View Source

Fast in-memory storage of schemas with access by global id or full name.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Retrieve a value by a given key.

Stores a value with a given key. If the value is already exists it will be replaced.

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Retrieve a value by a given key.

Examples

iex> {:ok, _} = Avrora.Storage.Memory.start_link()
iex> Avrora.Storage.Memory.put("my-key", %{"hello" => "world"})
{:ok, %{"hello" => "world"}}
iex> Avrora.Storage.Memory.get("my-key")
{:ok, %{"hello" => "world"}}
iex> Avrora.Storage.Memory.get("unknown-key")
{:ok, nil}

Stores a value with a given key. If the value is already exists it will be replaced.

Examples

iex> {:ok, _} = Avrora.Storage.Memory.start_link()
iex> avro = %Avrora.Schema{id: nil, ex_schema: %AvroEx.Schema{}, raw_schema: %{"k" => "v"}}
iex> Avrora.Storage.Memory.put("my-key", avro)
{:ok, %Avrora.Schema{id: nil, ex_schema: %AvroEx.Schema{}, raw_schema: %{"k" => "v"}}}