ShieldedCache v1.1.1 ShieldedCache.Cache.RedixSingleton View Source
ShieldedCache.Cache.Redix
A provided cache module that uses an already created and supervised Redix client for cache storage.
Link to this section Summary
Functions
ttl_seconds/0
Link to this section Functions
The default deserializer, which uses a simple JSON Decoder to decode the value to the corresponding object.
Return {:ok, value}
or {:error, reason}
.
Runs the deserialize/1
function and raises an error if an error is returned.
Returns the deserialized value
or raises an error.
Gets the value of the specified key from the cache.
Returns {:ok, value}
, {:expired, expired_value}
or {:error, reason}
.
get!(caching_module_name :: atom(), key :: String.t(), ttl :: non_neg_integer()) :: value :: any()
Runs the get/3
function and raises an error if an error is returned.
Returns the value
or raises an error.
Invalidates the value of the specified key in the cache.
Returns :ok
or {:error, reason}
.
Runs the invalidate/2
function and raises an error if an error is returned.
Returns :ok
or raises an error.
The default serializer, which uses a simple JSON Encoder to encode the value as a String.
Return {:ok, value}
or {:error, reason}
.
Runs the serialize/1
function and raises an error if an error is returned.
Returns the serialized value
or raises an error.
set( caching_module_name :: atom(), key :: String.t(), value :: any(), ttl :: non_neg_integer() ) :: :ok | {:error, reason :: any()}
Sets the value of the specified key in the cache.
Returns :ok
or {:error, reason}
.
set!( caching_module_name :: atom(), key :: String.t(), value :: any(), ttl :: non_neg_integer() ) :: :ok
Runs the set/4
function and raises an error if an error is returned.
Returns the :ok
or raises an error.
start_link(opts :: Keyword.t()) :: {:ok, nil}
Starts the ShieldedCache.Cache.Redis
Supervisor,
which in turn starts the ShieldedCache.Cache.Redis.Pool
module
under the ShieldedCache.Cache.Redis
supervision tree.
ttl_seconds/0
Returns the default TTL in seconds