SerializedCache
in package
implements
Cache
uses
ForbidCloning, ForbidSerialization
FinalYes
Tags
Table of Contents
Interfaces
Properties
Methods
- __construct() : mixed
- __serialize() : never
- __unserialize() : never
- delete() : bool|null
- Deletes a value associated with the given key if it exists.
- get() : TValue
- Fetch a value from the cache and unserialize it.
- set() : void
- Serializes a value and stores its serialization to the cache.
- __clone() : mixed
Properties
$cache read-only
private
StringCache
$cache
$serializer read-only
private
Serializer
$serializer
Methods
__construct()
public
__construct(StringCache $cache, Serializer $serializer) : mixed
Parameters
- $cache : StringCache
- $serializer : Serializer
__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(mixed $key) : bool|null
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()
Fetch a value from the cache and unserialize it.
public
get(mixed $key) : TValue
Parameters
- $key : mixed
-
string Cache key.
Tags
Return values
TValue —Returns the cached value or null if it doesn't exist.
set()
Serializes a value and stores its serialization to the cache.
public
set(string $key, TValue $value[, int|null $ttl = null ]) : void
Parameters
- $key : string
-
Cache key.
- $value : TValue
-
Value to cache.
- $ttl : int|null = null
-
Timeout in seconds. The default null $ttl value indicates no timeout. Values less than 0 MUST throw an \Error.
Tags
__clone()
protected
final __clone() : mixed