View Source Flowy.Support.Cache (Flowy v0.1.1)
The Cache
module provides a simple API for interacting with the configured
cache store.
Options
:opts
(keyword/0
) - The default value is[ttl: 300]
.:ttl
(integer/0
) - the time-to-live for a key in seconds. Default to 5 minutes. The default value is300
.
:store
(atom/0
) - the cache store module to use. The default value isFlowy.Support.Cache.MemoryStore
.
Summary
Functions
Builds a cache struct.
Deletes a value from the cache store using the default cache.
Deletes a value from the cache store.
Fetches a value from the cache store. If the key does not exist, the function is called and the result is stored in the cache store.
Reads a value from the cache store using the default cache.
Reads a value from the cache store.
Resets the cache store using the default cache.
Writes a value to the cache store using the default cache.
Writes a value to the cache store.
Types
Functions
Builds a cache struct.
@spec delete(key()) :: {:error, :not_found} | {:ok, :deleted}
Deletes a value from the cache store using the default cache.
Deletes a value from the cache store.
@spec fetch(cache(), key(), function()) :: any()
@spec fetch(key(), function(), opts :: keyword()) :: any()
Fetches a value from the cache store. If the key does not exist, the function is called and the result is stored in the cache store.
Reads a value from the cache store using the default cache.
Reads a value from the cache store.
@spec reset() :: :ok
Resets the cache store using the default cache.
@spec reset(cache()) :: :ok
Writes a value to the cache store using the default cache.
Writes a value to the cache store.