Documentation

PdbStaticCache extends PdbCache
in package
implements ConfigurableInterface uses UpdateTrait

Static cache.

Lifetime of data in this cache is only that of the request.

As such, be careful if you've built your queries with this assumption in mind and then switch to a persistent/cross-request cache.

By default TTL expiration is not enabled for this cache. It can be enabled with the enable_ttl config but for 90% of user cases it's not necessary as this cache doesn't live beyond the current request. The exception being long-running CLI tasks.

Table of Contents

Interfaces

ConfigurableInterface
This class is 'configurable' - it has an `update()` method that accepts iterables.

Properties

$enable_ttl  : bool
Enable expiry of keys as advised by the TTL.
$cache  : array<string|int, mixed>
$timeouts  : array<string|int, mixed>

Methods

clear()  : void
Remove this cache item.
get()  : mixed|null
has()  : bool
store()  : void
update()  : void
_clean()  : void
Remove timeouts, if TTLs are enabled.

Properties

$enable_ttl

Enable expiry of keys as advised by the TTL.

public bool $enable_ttl = false

$cache

protected static array<string|int, mixed> $cache = []

[ key => result ]

$timeouts

protected static array<string|int, mixed> $timeouts = []

[ key => seconds ]

Methods

clear()

Remove this cache item.

public clear([string|null $key = null ]) : void
Parameters
$key : string|null = null
Tags
inheritdoc

get()

public get(string $key) : mixed|null
Parameters
$key : string
Tags
inheritdoc
Return values
mixed|null

has()

public has(string $key) : bool
Parameters
$key : string
Tags
inheritdoc
Return values
bool

store()

public store(string $key, mixed $result, float $ttl) : void
Parameters
$key : string
$result : mixed
$ttl : float
Tags
inheritdoc

update()

public update(iterable<string|int, mixed> $config) : void
Parameters
$config : iterable<string|int, mixed>

_clean()

Remove timeouts, if TTLs are enabled.

protected _clean(string $key) : void
Parameters
$key : string
On this page

Search results