CRM_Utils_Cache_ArrayDecorator
class CRM_Utils_Cache_ArrayDecorator implements CRM_Utils_Cache_Interface
Class CRM_Utils_Cache_ArrayDecorator
This creates a two-tier cache-hierarchy: a thread-local, array-based cache combined with some third-party cache driver.
Ex: $cache = new CRM_Utils_Cache_ArrayDecorator(new CRM_Utils_Cache_Redis(...));
Traits
Properties
protected int | $defaultTimeout |
Methods
Obtains multiple cache items by their unique keys.
Persists a set of key => value pairs in the cache, with an optional TTL.
Deletes multiple cache items in a single operation.
CRM_Utils_Cache_ArrayDecorator constructor.
Get a value from the cache.
Delete a value from the cache.
Delete all values from the cache.
Delete all values from the cache.
Determines whether an item is present in the cache.
Details
in CRM_Utils_Cache_NaiveMultipleTrait at line 53
iterable
getMultiple(iterable $keys, mixed $default = NULL)
Obtains multiple cache items by their unique keys.
in CRM_Utils_Cache_NaiveMultipleTrait at line 77
bool
setMultiple(iterable $values, null|int|DateInterval $ttl = NULL)
Persists a set of key => value pairs in the cache, with an optional TTL.
in CRM_Utils_Cache_NaiveMultipleTrait at line 101
bool
deleteMultiple(iterable $keys)
Deletes multiple cache items in a single operation.
at line 76
__construct(CRM_Utils_Cache_Interface $delegate, int $defaultTimeout = 3600)
CRM_Utils_Cache_ArrayDecorator constructor.
at line 81
bool
set(string $key, mixed $value, null|int|DateInterval $ttl = NULL)
Set the value in the cache.
at line 97
mixed
get(string $key, mixed $default = NULL)
Get a value from the cache.
at line 114
bool
delete(string $key)
Delete a value from the cache.
at line 121
bool
flush()
Delete all values from the cache.
NOTE: flush() and clear() should be aliases. flush() is specified by Civi's traditional interface, and clear() is specified by PSR-16.
at line 125
bool
clear()
Delete all values from the cache.
NOTE: flush() and clear() should be aliases. flush() is specified by Civi's traditional interface, and clear() is specified by PSR-16.
at line 131
bool
has(string $key)
Determines whether an item is present in the cache.
NOTE: It is recommended that has() is only to be used for cache warming type purposes and not to be used within your live applications operations for get/set, as this method is subject to a race condition where your has() will return true and immediately after, another script can remove it making the state of your app out of date.