Wrapper for Cake engines that allow them to support the PSR16 Simple Cache Interface
$innerEngine
protected __construct( Cake\Cache\CacheEngine $innerEngine )
Constructor
Cake\Cache\CacheEngine
$innerEngine
add( string $key , mixed $value )
Write data for key into a cache engine if it doesn't exist already.
$key
$value
True if the data was successfully cached, false on failure. Or if the key existed already.
Cake\Cache\CacheEngineInterface::add()
clear( )
Wipes clean the entire cache's keys.
clearGroup( string $group )
Clear all values belonging to the named group.
$group
Cake\Cache\CacheEngineInterface::clearGroup()
decrement( string $key , integer $offset = 1 )
Decrement a number under the key and return decremented value
$key
$offset
optional 1 Cake\Cache\CacheEngineInterface::decrement()
delete( string $key )
Delete an item from the cache by its unique key.
$key
Cake\Cache\InvalidArgumentException
deleteMultiple( iterable $keys )
Deletes multiple cache items in a single operation.
$keys
Cake\Cache\InvalidArgumentException
If $keys is neither an array nor a Traversable, or if any of the $keys are not a legal value.
ensureValidKey( string $key )
Ensure the validity of the given cache key.
$key
Cake\Cache\InvalidArgumentException
ensureValidKeys( mixed $keys )
Ensure the validity of the given cache keys.
$keys
Cake\Cache\InvalidArgumentException
get( string $key , mixed $default = null )
Fetches the value for a given key from the cache.
$key
$default
optional null Cake\Cache\InvalidArgumentException
getMultiple( iterable $keys , mixed $default = null )
Obtains multiple cache items by their unique keys.
$keys
$default
optional null Cake\Cache\InvalidArgumentException
If $keys is neither an array nor a Traversable, or if any of the $keys are not a legal value.
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.
$key
Cake\Cache\InvalidArgumentException
increment( string $key , integer $offset = 1 )
Increment a number under the key and return incremented value
$key
$offset
optional 1 Cake\Cache\CacheEngineInterface::increment()
set( string $key , mixed $value , null|integer|DateInterval $ttl = null )
Persists data in the cache, uniquely referenced by the given key with an optional expiration TTL time.
$key
$value
$ttl
optional null Optional. The TTL value of this item. If no value is sent and the driver supports TTL then the library may set a default value for it or let the driver take care of that.
Cake\Cache\InvalidArgumentException
setMultiple( iterable $values , null|integer|DateInterval $ttl = null )
Persists a set of key => value pairs in the cache, with an optional TTL.
$values
$ttl
optional null Optional. The TTL value of this item. If no value is sent and the driver supports TTL then the library may set a default value for it or let the driver take care of that.
Cake\Cache\InvalidArgumentException
If $values is neither an array nor a Traversable, or if any of the $values are not a legal value.
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/3.8/class-Cake.Cache.SimpleCacheEngine.html