Fiat.CacheServer.fetch_object
You're seeing just the function
fetch_object
, go back to Fiat.CacheServer module for more information.
Specs
Fetches the cached object for a particular key.
Returns object if it exists in the cache, otherwise
returns nil
.
Examples
iex> Fiat.CacheServer.cache_object("data", {"code", 2})
iex> Fiat.CacheServer.fetch_object("data")
{"code", 2}
iex> Fiat.CacheServer.fetch_object("data_old")
nil
Specs
Fetches the cached object for a particular key. If
the cache_key
is not present in the cache, it
executes the provided query_fn
paramter, stores
the result in the cache and returns it.
Returns either the cached object or the result of
the query_fn
parameter.
Examples
iex> Fiat.CacheServer.cache_object("data", :data)
iex> Fiat.CacheServer.fetch_object("data", fn -> :ok end)
:data
iex> Fiat.CacheServer.fetch_object("data", fn -> :ok end)
:ok