View Source ProcessHub.Service.Storage (ProcessHub v0.3.2-alpha)
The local storage service provides API functions for managing local storage. This is mainly used for storing data that is not required to be persisted.
Local storage is implemented using ETS tables and is cleared periodically.
Summary
Functions
Deletes all objects from the ETS table.
Returns a boolean indicating whether the key exists in local storage.
Exports all objects from the ETS table.
Returns the value for the key in local storage.
Inserts the key and value into local storage.
Removes an entry from the storage.
Updates the value for the key in local storage.
Types
@type table_id() :: atom()
Functions
Deletes all objects from the ETS table.
Never use in custom code. Should only be used for testing purposes.
Returns a boolean indicating whether the key exists in local storage.
@spec export_all(table_id()) :: [{atom() | binary(), term(), pos_integer() | nil}]
Exports all objects from the ETS table.
Returns the value for the key in local storage.
If the key does not exist, nil is returned; otherwise, the value is returned in
the format of a tuple: {key, value, ttl}
.
Inserts the key and value into local storage.
Available options:
ttl
: The time to live for the key in milliseconds.
Removes an entry from the storage.
Updates the value for the key in local storage.
The func
function is expected to take the current value as an argument and
return the new value.
If the key does not exist, the current value is nil.