ExpiringCache
in package
implements
CacheInterface
Adds expiration to a cache backend.
Tags
Interfaces, Classes and Traits
- CacheInterface
- Interface for a cache backend.
Table of Contents
- $cache : mixed
- $lifetime : mixed
- __construct() : mixed
- get() : string|null
- Returns the value for a key.
- has() : bool
- Checks if the cache has a value for a key.
- remove() : mixed
- Removes a value from the cache.
- set() : mixed
- Sets a value in the cache.
Properties
$cache
private
mixed
$cache
$lifetime
private
mixed
$lifetime
Methods
__construct()
public
__construct(CacheInterface $cache, mixed $lifetime) : mixed
Parameters
- $cache : CacheInterface
- $lifetime : mixed
Return values
mixed —get()
Returns the value for a key.
public
get(mixed $key) : string|null
Parameters
- $key : mixed
-
A unique key
Return values
string|null —The value in the cache
has()
Checks if the cache has a value for a key.
public
has(mixed $key) : bool
Parameters
- $key : mixed
-
A unique key
Return values
bool —Whether the cache has a value for this key
remove()
Removes a value from the cache.
public
remove(mixed $key) : mixed
Parameters
- $key : mixed
-
A unique key
Return values
mixed —set()
Sets a value in the cache.
public
set(mixed $key, mixed $value) : mixed
Parameters
- $key : mixed
-
A unique key
- $value : mixed
-
The value to cache