Skip to content

Internals Vfs Cache Cache

Stefan Crkvenjakov edited this page Oct 7, 2026 · 1 revision

vfs\cache\Cache

Framework Internals · Subsystem overview · Developer guide

Source: awt_src/classes/vfs/cache/Cache.php · Snapshot 8411f4287706.

VFS includes package resource lookup, database-backed file metadata, filesystem collaborators, transient pools and persistent PHP-array caches.

Cache

Declaration and architectural role

class Cache

Constants, enum cases, traits and properties

Declarations below preserve visibility, type, default and modifiers exactly. A typed property without an initializer remains uninitialized until its constructor or another method assigns it. Mutable fields belong to this instance unless marked static; readonly fields can be initialized once. Constructor-promoted properties are also listed below.

Member Declaration Purpose or source contract
$pools private static array $pools = []; Used by pool().

Method index

Method Signature
pool public static function pool(string $name): CachePool
get public static function get(string $pool, string $key): bool|array
set public static function set(string $pool, string $key, array $data): CacheEntry
delete public static function delete(string $pool, string $key): bool

pool

Source line 9

public static function pool(string $name): CachePool

Parameters

Parameter Type, modifiers and default Purpose
$name string $name Named key/label selected by this API; its exact scope is shown by the implementation trace.

Return expressions (including local callbacks): self::$pools[$name].

Implementation, validation guards and interaction order
public static function pool(string $name): CachePool
    {
        if (!isset(self::$pools[$name])) {
            self::$pools[$name] = new CachePool($name);
        }

        return self::$pools[$name];
    }

get

Source line 18

public static function get(string $pool, string $key): bool|array

Parameters

Parameter Type, modifiers and default Purpose
$pool string $pool Operation input; the exact use, validation and propagation are shown in the implementation trace.
$key string $key Operation input; the exact use, validation and propagation are shown in the implementation trace.

Return expressions (including local callbacks): self::pool($pool)->getCache($key).

Implementation, validation guards and interaction order
public static function get(string $pool, string $key): bool|array
    {
        return self::pool($pool)->getCache($key);
    }

set

Source line 23

public static function set(string $pool, string $key, array $data): CacheEntry

Parameters

Parameter Type, modifiers and default Purpose
$pool string $pool Operation input; the exact use, validation and propagation are shown in the implementation trace.
$key string $key Operation input; the exact use, validation and propagation are shown in the implementation trace.
$data array $data Input data array or payload; see allowed fields and validation guards below.

Return expressions (including local callbacks): self::pool($pool)->setCache($key, $data).

Implementation, validation guards and interaction order
public static function set(string $pool, string $key, array $data): CacheEntry
    {
        return self::pool($pool)->setCache($key, $data);
    }

delete

Source line 28

public static function delete(string $pool, string $key): bool

Parameters

Parameter Type, modifiers and default Purpose
$pool string $pool Operation input; the exact use, validation and propagation are shown in the implementation trace.
$key string $key Operation input; the exact use, validation and propagation are shown in the implementation trace.

Return expressions (including local callbacks): self::pool($pool)->deleteCache($key).

Implementation, validation guards and interaction order
public static function delete(string $pool, string $key): bool
    {
        return self::pool($pool)->deleteCache($key);
    }

Clone this wiki locally