NullCache
in package
implements
Cache
uses
ForbidCloning, ForbidSerialization
Cache implementation that just ignores all operations and always resolves to `null`.
Tags
Table of Contents
Interfaces
Methods
- __serialize() : never
- __unserialize() : never
- delete() : bool|null
- Deletes a value associated with the given key if it exists.
- get() : TValue|null
- Gets a value associated with the given key.
- set() : void
- Sets a value associated with the given key. Overrides existing values (if they exist).
- __clone() : mixed
Methods
__serialize()
public
final __serialize() : never
Return values
never__unserialize()
public
final __unserialize(array<string|int, mixed> $data) : never
Parameters
- $data : array<string|int, mixed>
Return values
neverdelete()
Deletes a value associated with the given key if it exists.
public
delete(string $key) : bool|null
Implementations SHOULD return boolean true or false to indicate whether the specified key existed at the time the delete operation was requested. If such information is not available, the implementation MUST return null.
Implementations MUST NOT error for non-existent keys.
Parameters
- $key : string
-
string Cache key.
Return values
bool|null —Returns true / false to indicate whether the key existed, or null if that information is not available.
get()
Gets a value associated with the given key.
public
get(string $key) : TValue|null
If the specified key doesn't exist implementations MUST return null.
Parameters
- $key : string
-
string Cache key.
Return values
TValue|null —Returns the cached value, or null if it doesn't exist
set()
Sets a value associated with the given key. Overrides existing values (if they exist).
public
set(string $key, mixed $value[, int|null $ttl = null ]) : void
TTL values less than 0 MUST throw an \Error.
Parameters
- $key : string
-
string Cache key.
- $value : mixed
-
TValue Value to cache.
- $ttl : int|null = null
-
int Timeout in seconds >= 0. The default null $ttl value indicates no timeout.
__clone()
protected
final __clone() : mixed