crux_cache v0.1.1 Crux.Cache.Presence View Source
Default Crux.Structs.Presence
cache.
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor
Deletes data from the cache by key
Fetches data from the cache by key
Fetches data from the cache by key, raises if not found
Inserts data into the cache
Used to start anything fitting under a supervision tree, like for example a GenServer
, instructed with handling the cache
Inserts data into the cache
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Deletes data from the cache by key.
Always returns :ok
, even when the key did not exist.
Callback implementation for Crux.Cache.delete/1
.
Fetches data from the cache by key.
Callback implementation for Crux.Cache.fetch/1
.
Fetches data from the cache by key, raises if not found.
Callback implementation for Crux.Cache.fetch!/1
.
Inserts data into the cache.
Returns the atomified data allowing the operation to be chained.
For example something like that:
id =
raw_data
|> Cache.insert()
|> Map.get(:id)
Callback implementation for Crux.Cache.insert/1
.
start_link(args :: term()) :: GenServer.on_start()
Used to start anything fitting under a supervision tree, like for example a GenServer
, instructed with handling the cache.
Optional, you maybe want to use external caching, e.g. Redis, not requiring anything like that.
Callback implementation for Crux.Cache.start_link/1
.
Inserts data into the cache.
Returns “updated” data including changes by merging.
For example from a message embed update to a full message object
content =
partial_message # only contains `:id`, `:channel_id`, and `:embeds`
|> Cache.update()
|> Map.get(:content) # present if the message was cached previously
Callback implementation for Crux.Cache.update/1
.