Methods |
public
|
init(): void
Initialize parent::__construct calls this after verifying module object.
Initialize parent::__construct calls this after verifying module object.
Implements
|
#
|
protected
|
prefix(string $name): string
Add our module prefix to a name
Add our module prefix to a name
Parameters
Returns
|
#
|
public
|
write(string $key, mixed $value, int|null $ttl = null): bool
Write a value for a key to the cache
Write a value for a key to the cache
Parameters
$key |
Identifier for the data
|
$value |
Data to be cached - anything except a resource
|
$ttl |
Time to live in seconds
|
Returns
True if the data was successfully cached, false on failure
|
#
|
public
|
read(string $key, mixed $default = false): mixed
Read value for a key from the cache
Read value for a key from the cache
Parameters
$key |
Identifier for the data
|
$default |
default value to return if config $key is not set
|
Returns
value if key was set, false not set or expired
|
#
|
public
|
delete(string $key): void
Delete a key from the cache
Delete a key from the cache
Parameters
$key |
Identifier for the data
|
|
#
|
public
|
cacheRead(string $key, callable $regenFunction, int|null $ttl = null, mixed $args = null): mixed
cache block wrapper
cache block wrapper
If the cache read for $key is a miss, call the $regenFunction to update it.
Parameters
$key |
Identifier for the cache item
|
$regenFunction |
function to generate cached content
|
$ttl |
time to live, number of seconds as integer
or null for default
|
$args |
variable argument list for $regenFunction
|
|
#
|