ShieldedCache v1.0.0 ShieldedCache.Cache.Redis View Source
ShieldedCache.Cache.Redis
A provided cache module that uses Redis as the cache storage module.
Link to this section Summary
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
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.
Initializes the ShieldedCache.Cache.Redis
Supervisor,
which in turn starts the ShieldedCache.Cache.Redis.Pool
module
under the ShieldedCache.Cache.Redis
supervision tree.
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.
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