Determines whether value exists in cache.
Determines whether value exists in cache.
cache storage key
record existence, true if exists, otherwise false
refreshes expiration time on a given key, useful, e.g., when we want to refresh session duration
refreshes expiration time on a given key, useful, e.g., when we want to refresh session duration
cache storage key
new expiration in seconds
promise
Retrieve a value from the cache.
Retrieve a value from the cache.
cache storage key
stored record, Some if exists, otherwise None
Retrieve a value from the cache.
Retrieve a value from the cache. If is missing, set default value with given expiration and return the value.
cache storage key
expiration period in seconds.
The default function to invoke if the value was not found in cache.
stored or default record, Some if exists, otherwise None
Retrieve a value from the cache.
Retrieve a value from the cache. If is missing, set default value with given expiration and return the value.
cache storage key
expiration period in seconds.
The default function to invoke if the value was not found in cache.
stored or default record, Some if exists, otherwise None
Remove all keys in cache
Remove all keys in cache
promise
Retrieves all keys matching the given pattern.
Retrieves all keys matching the given pattern. This method invokes KEYS command
Warning: complexity is O(n) where n are all keys in the database
valid KEYS pattern with wildcards
list of matching keys
Remove all values from the cache
Remove all values from the cache
cache storage key
cache storage key
cache storage keys
promise
Remove a value under the given key from the cache
Remove a value under the given key from the cache
cache storage key
promise
Removes all keys in arguments.
Removes all keys in arguments. The other remove methods are for syntax sugar
cache storage keys
promise
Removes all keys matching the given pattern.
Removes all keys matching the given pattern. This command has no direct support in Redis, it is combination of KEYS and DEL commands.
KEYS pattern
command finds all keys matching the given patternDEL keys
expires all of themThis is usable in scenarios when multiple keys contains same part of the key, such as
record identification, user identification, etc. For example, we may have keys such
as 'page/$id/header', 'page/$id/body', 'page/$id/footer' and we want to remove them
all when the page is changed. We use the benefit of the naming convention we use and
execute removeAllMatching( s"page/$id/*" )
, which invalidates everything related to
the given page. The benefit is we do not need to maintain the list of all keys to invalidate,
we invalidate them all at once.
Warning: complexity is O(n) where n are all keys in the database
this must be valid KEYS pattern
nothing
Set a value into the cache.
Set a value into the cache. Expiration time in seconds (0 second means eternity).
cache storage key
value to store
record duration in seconds
promise
Cache API inspired by basic Play play.api.cache.CacheApi. It implements all its operations and in addition it declares couple more useful operations handful with cache storage. Furthermore, due to its parametrization it allows to decide whether it produces blocking results or non-blocking promises.