Object -
cache
:
AbstractCache
The cache:AbstractCache
object is used for custom implementations of the Ballerina cache.
Any custom cache implementation should be object-wise similar.
Methods
Parameters
- key string
-
Key of the value to be cached
- value any
-
Value to be cached
- maxAgeInSeconds int (default -1)
-
The time in seconds during which the cache entry is valid. '-1' means, the entry is valid forever
-
Return Type
(Error?) ()
if successfully added to the cache orError
if any error occurred while inserting the entry to the cache
Parameters
- key string
-
The key used to retrieve the cached value
-
Return Type
(any | Error) The cached value associated with the given key or an
Error
if the provided cache key is not available or if any error occurred while retrieving from the cache
Parameters
- key string
-
Key of the cache entry which needs to be discarded
-
Return Type
(Error?) ()
if successfully discarded or anError
if the provided cache key is not available or if any error occurred while discarding from the cache
-
Return Type
(Error?) ()
if successfully discarded all or anError
if any error occurred while discarding all from the cache
Parameters
- key string
-
The key to be checked
-
Return Type
(boolean) true
if an associated cache value is available for the provided key orfalse
if there is not a cache value associated with the provided key
-
Return Type
(string[]) Array of all the keys from the cache