StringCache
in
Table of Contents
Methods
- delete() : bool|null
- Deletes a value associated with the given key if it exists.
- get() : string|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).
Methods
delete()
Deletes a value associated with the given key if it exists.
public
delete(mixed $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 : mixed
-
string Cache key.
Tags
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(mixed $key) : string|null
If the specified key doesn't exist implementations MUST return null.
Parameters
- $key : mixed
-
string Cache key.
Tags
Return values
string|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(mixed $key, mixed $value[, mixed $ttl = null ]) : void
TTL values less than 0 MUST throw an \Error.
Parameters
- $key : mixed
-
string Cache key.
- $value : mixed
-
string Value to cache.
- $ttl : mixed = null
-
int Timeout in seconds >= 0. The default null $ttl value indicates no timeout.