View Source ProcessHub.Service.LocalStorage (ProcessHub v0.2.0-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
Returns a boolean indicating whether the key exists in local storage.
Returns the value for the key in local storage.
Inserts the key and value into local storage.
Functions
@spec exists?(ProcessHub.hub_id(), term()) :: boolean()
Returns a boolean indicating whether the key exists in local storage.
@spec get(ProcessHub.hub_id(), term()) :: term()
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}
.
@spec insert(ProcessHub.hub_id(), term(), term(), pos_integer() | nil) :: boolean()
Inserts the key and value into local storage.
It is possible to set a time to live (TTL) for the key. If the TTL is set to nil, the key will not expire.
The ttl
value is expected to be a positive integer in milliseconds.