phasync
LruCache / set

Method

LruCache::set

Stores $value under $key, making room as needed.

Description#

public LruCache::set(
    string $key,
    mixed $value,
    ?float $ttl = null
): bool

Returns false when the value alone is larger than $maxBytes: it is not stored, and an older value under $key is removed.

Parameters#

$key string
$value mixed
$ttl ?float = null
Seconds until it expires; null for never

Return values#

bool