ExPirate v0.1.0 ExPirate.Utils
Link to this section Summary
Functions
Returns :ttl
, :expired?
, :attrs
or a custom property using
AgentMap.Utils.get_prop/2
Stores property using AgentMap.Utils.set_prop/3
Update given property using AgentMap.Utils.upd_prop/3
Link to this section Types
Link to this type
attr()
attr()
attr() :: ExPirate.attr()
attr() :: ExPirate.attr()
Link to this type
custom()
custom()
custom() :: ExPirate.custom()
custom() :: ExPirate.custom()
Link to this type
ep()
ep()
ep() :: ExPirate.ep()
ep() :: ExPirate.ep()
Link to this type
item()
item()
item() :: ExPirate.item()
item() :: ExPirate.item()
Link to this section Functions
Link to this function
get_prop(ep, p)
Returns :ttl
, :expired?
, :attrs
or a custom property using
AgentMap.Utils.get_prop/2
.
Link to this function
set_prop(ep, prop, list)
Stores property using AgentMap.Utils.set_prop/3
.
Supported :expired?
, :ttl
, :attrs
and any custom property.
Be aware that setting :expired?
deletes :ttl
and vice versa.
Examples
iex> {:ok, ep} = ExPirate.start(ttl: 30)
iex> get_prop(ep, :ttl)
30
iex> ep
...> |> set_prop(:ttl, 50)
...> |> get_prop(:ttl)
50
iex> ep
...> |> set_prop(:custom, "some param")
...> |> get_prop(:custom)
"some param"
Update given property using AgentMap.Utils.upd_prop/3
.
To change :expired?
, :ttl
or :attrs
use set_prop/3
.
Examples
iex> {:ok, ep} = ExPirate.start()
iex> ep
...> |> set_prop(:custom, 42)
...> |> upd_prop(:custom, & &1 * 2)
...> |> get_prop(:custom)
84