CounterEx v0.1.0 CounterEx View Source
Documentation for CounterEx.
Link to this section Summary
Functions
Returns all the counters as list ex. [{key, value}....{key, value}]
Returns the value of the counter or nil
Create/Update the counter by 1 (default) or custom step. Returns the new value
Reset the value of a counter to 0 or custom step
Set the value of a counter to 0 or custom step
Link to this section Functions
Returns all the counters as list ex. [{key, value}....{key, value}]
Examples
iex> CounterEx.all
nil
iex> CounterEx.inc("sample.key") && CounterEx.all
[{"sample.key", 1}]
Returns the value of the counter or nil
Examples
iex> CounterEx.get("sample.key")
nil
iex> CounterEx.inc("sample.key") && CounterEx.get("sample.key")
1
Create/Update the counter by 1 (default) or custom step. Returns the new value
Examples
iex> CounterEx.inc("sample.key")
1
iex> CounterEx.inc("sample.key")
2
iex> CounterEx.inc(:sample_key)
1
Reset the value of a counter to 0 or custom step
Examples
iex> CounterEx.reset("test.key")
true
Set the value of a counter to 0 or custom step
Examples
iex> CounterEx.set("test.key")
true