Null cache engine, all operations appear to work, but do nothing.
This is used internally for when Cache::disable() has been called.
string
'key'
string
'value'
array<string, mixed>
Runtime config
bool
Whether the config property has already been configured with defaults
array<string, mixed>
The default cache configuration is overridden in most cache adapters. These are the keys that are common to all adapters. If overridden, this property is not used.
string
Contains the compiled string with all group prefixes to be prepended to every key in this cache engine
Deletes a single config key.
Reads a config key.
Writes a config key.
Generates a key for cache backend usage.
Add a key to the cache if it does not already exist.
Delete all keys from the cache
Clears all values belonging to a group. Is up to the implementing engine to decide whether actually delete the keys or just simulate it to achieve the same result.
Merge provided config with existing config. Unlike config()
which does a recursive merge for nested keys, this method does a simple merge.
Decrement a number under the key and return decremented value
Delete a key from the cache
Deletes multiple cache items as a list
Convert the various expressions of a TTL value into duration in seconds
Ensure the validity of the given cache key.
Ensure the validity of the argument type and cache keys.
Fetches the value for a given key from the cache.
Returns the config.
Returns the config for this specific key.
Obtains multiple cache items by their unique keys.
Does whatever initialization for each group is required and returns the group value
for each of them, this is the token representing each group in the cache key
Determines whether an item is present in the cache.
Increment a number under the key and return incremented value
Initialize the cache engine
Persists data in the cache, uniquely referenced by the given key with an optional expiration TTL time.
Sets the config.
Persists a set of key => value pairs in the cache, with an optional TTL.
Cache Engines may trigger warnings if they encounter failures during operation, if option warnOnWriteFailures is set to true.
_configDelete(string $key): void
Deletes a single config key.
string
$key Key to delete.
void
Cake\Core\Exception\CakeException
_configRead(string|null $key): mixed
Reads a config key.
string|null
$key Key to read.
mixed
_configWrite(array<string, mixed>|string $key, mixed $value, string|bool $merge = false): void
Writes a config key.
array<string, mixed>|string
$key Key to write to.
mixed
$value Value to write.
string|bool
$merge optional True to merge recursively, 'shallow' for simple merge, false to overwrite, defaults to false.
void
Cake\Core\Exception\CakeException
_key(string $key): string
Generates a key for cache backend usage.
If the requested key is valid, the group prefix value and engine prefix are applied. Whitespace in keys will be replaced.
string
$key the key passed over
string
Cake\Cache\InvalidArgumentException
add(string $key, mixed $value): bool
Add a key to the cache if it does not already exist.
Defaults to a non-atomic implementation. Subclasses should prefer atomic implementations.
string
$key Identifier for the data.
mixed
$value Data to be cached.
bool
clear(): bool
Delete all keys from the cache
bool
clearGroup(string $group): bool
Clears all values belonging to a group. Is up to the implementing engine to decide whether actually delete the keys or just simulate it to achieve the same result.
Each implementation needs to decide whether actually delete the keys or just augment a group generation value to achieve the same result.
string
$group bool
configShallow(array<string, mixed>|string $key, mixed|null $value = null): $this
Merge provided config with existing config. Unlike config()
which does a recursive merge for nested keys, this method does a simple merge.
Setting a specific value:
$this->configShallow('key', $value);
Setting a nested value:
$this->configShallow('some.nested.key', $value);
Updating multiple config settings at the same time:
$this->configShallow(['one' => 'value', 'another' => 'value']);
array<string, mixed>|string
$key The key to set, or a complete array of configs.
mixed|null
$value optional The value to set.
$this
decrement(string $key, int $offset = 1): int|false
Decrement a number under the key and return decremented value
string
$key int
$offset optional int|false
delete(string $key): bool
Delete a key from the cache
string
$key bool
deleteMultiple(iterable $keys): bool
Deletes multiple cache items as a list
This is a best effort attempt. If deleting an item would create an error it will be ignored, and all items will be attempted.
iterable
$keys bool
duration(DateInterval|int|null $ttl): int
Convert the various expressions of a TTL value into duration in seconds
DateInterval|int|null
$ttl The TTL value of this item. If null is sent, the driver's default duration will be used.
int
ensureValidKey(string $key): void
Ensure the validity of the given cache key.
string
$key Key to check.
void
Cake\Cache\InvalidArgumentException
ensureValidType(iterable $iterable, string $check = self::CHECK_VALUE): void
Ensure the validity of the argument type and cache keys.
iterable
$iterable The iterable to check.
string
$check optional Whether to check keys or values.
void
Cake\Cache\InvalidArgumentException
get(string $key, mixed $default = null): mixed
Fetches the value for a given key from the cache.
string
$key mixed
$default optional mixed
getConfig(string|null $key = null, mixed $default = null): mixed
Returns the config.
Reading the whole config:
$this->getConfig();
Reading a specific value:
$this->getConfig('key');
Reading a nested value:
$this->getConfig('some.nested.key');
Reading with default value:
$this->getConfig('some-key', 'default-value');
string|null
$key optional The key to get or null for the whole config.
mixed
$default optional The return value when the key does not exist.
mixed
getConfigOrFail(string $key): mixed
Returns the config for this specific key.
The config value for this key must exist, it can never be null.
string
$key The key to get.
mixed
InvalidArgumentException
getMultiple(iterable $keys, mixed $default = null): iterable
Obtains multiple cache items by their unique keys.
iterable
$keys mixed
$default optional iterable
groups(): array<string>
Does whatever initialization for each group is required and returns the group value
for each of them, this is the token representing each group in the cache key
array<string>
has(string $key): bool
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.
string
$key The cache item key.
bool
Cake\Cache\InvalidArgumentException
increment(string $key, int $offset = 1): int|false
Increment a number under the key and return incremented value
string
$key int
$offset optional int|false
init(array<string, mixed> $config = []): bool
Initialize the cache engine
Called automatically by the cache frontend. Merge the runtime config with the defaults before use.
array<string, mixed>
$config optional bool
set(string $key, mixed $value, null|intDateInterval $ttl = null): bool
Persists data in the cache, uniquely referenced by the given key with an optional expiration TTL time.
string
$key mixed
$value null|intDateInterval
$ttl optional bool
setConfig(array<string, mixed>|string $key, mixed|null $value = null, bool $merge = true): $this
Sets the config.
Setting a specific value:
$this->setConfig('key', $value);
Setting a nested value:
$this->setConfig('some.nested.key', $value);
Updating multiple config settings at the same time:
$this->setConfig(['one' => 'value', 'another' => 'value']);
array<string, mixed>|string
$key The key to set, or a complete array of configs.
mixed|null
$value optional The value to set.
bool
$merge optional Whether to recursively merge or overwrite existing config, defaults to true.
$this
Cake\Core\Exception\CakeException
setMultiple(iterable $values, null|intDateInterval $ttl = null): bool
Persists a set of key => value pairs in the cache, with an optional TTL.
iterable
$values null|intDateInterval
$ttl optional bool
warning(string $message): void
Cache Engines may trigger warnings if they encounter failures during operation, if option warnOnWriteFailures is set to true.
string
$message The warning message.
void
Runtime config
array<string, mixed>
Whether the config property has already been configured with defaults
bool
The default cache configuration is overridden in most cache adapters. These are the keys that are common to all adapters. If overridden, this property is not used.
duration
Specify how long items in this cache configuration last.groups
List of groups or 'tags' associated to every key stored in this config. handy for deleting a complete group from cache.prefix
Prefix appended to all entries. Good for when you need to share a keyspace with either another cache config or another application.warnOnWriteFailures
Some engines, such as ApcuEngine, may raise warnings on write failures.array<string, mixed>
Contains the compiled string with all group prefixes to be prepended to every key in this cache engine
string
© 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/4.4/class-Cake.Cache.Engine.NullEngine.html