Skip to content

Internals Vfs Resource ResourceCache

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

vfs\resource\ResourceCache

Framework Internals · Subsystem overview · Developer guide

Source: awt_src/classes/vfs/resource/ResourceCache.php · Snapshot 8411f4287706.

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

Imports and dependencies

use vfs\cache\Cache;
use vfs\cache\enums\ECacheValidation;

ResourceCache

Declaration and architectural role

class ResourceCache

Constants, enum cases, traits and properties

No own constants, enum cases, traits or property declarations. Inherited members are documented on the parent reference page.

Method index

Method Signature
cache public static function cache(string $context, array $watch, array $content, string $root = PACKAGES): void
get public static function get(string $context, string $root = PACKAGES): array|bool
delete public static function delete(string $context, string $root = PACKAGES): bool
key private static function key(string $context, string $root): string

cache

Source line 10

public static function cache(string $context, array $watch, array $content, string $root = PACKAGES): void

Parameters

Parameter Type, modifiers and default Purpose
$context string $context Package context object or package name according to the declared type.
$watch array $watch Operation input; the exact use, validation and propagation are shown in the implementation trace.
$content array $content Operation input; the exact use, validation and propagation are shown in the implementation trace.
$root string $root = PACKAGES Operation input; the exact use, validation and propagation are shown in the implementation trace.

Computes or delegates the operation shown below; no explicit receiver property assignment or throw occurs in this method.

Implementation, validation guards and interaction order
public static function cache(string $context, array $watch, array $content, string $root = PACKAGES): void
    {
        $cache = new Cache();
        $cache->pool("resource")->createConfig(ECacheValidation::MODIFIED, $watch)->setCache(self::key($context, $root), $content);
    }

get

Source line 16

public static function get(string $context, string $root = PACKAGES): array|bool

Parameters

Parameter Type, modifiers and default Purpose
$context string $context Package context object or package name according to the declared type.
$root string $root = PACKAGES Operation input; the exact use, validation and propagation are shown in the implementation trace.

Return expressions (including local callbacks): Cache::get("resource", self::key($context, $root)).

Implementation, validation guards and interaction order
public static function get(string $context, string $root = PACKAGES): array|bool
    {
        return Cache::get("resource", self::key($context, $root));
    }

delete

Source line 22

public static function delete(string $context, string $root = PACKAGES): bool

Parameters

Parameter Type, modifiers and default Purpose
$context string $context Package context object or package name according to the declared type.
$root string $root = PACKAGES Operation input; the exact use, validation and propagation are shown in the implementation trace.

Remove the package resource map; an absent map is already clean.

Return expressions (including local callbacks): Cache::pool('resource')->deleteCache(self::key($context, $root), true).

Implementation, validation guards and interaction order
/** Remove the package resource map; an absent map is already clean. */
    public static function delete(string $context, string $root = PACKAGES): bool
    {
        return Cache::pool('resource')->deleteCache(self::key($context, $root), true);
    }

key

Source line 27

private static function key(string $context, string $root): string

Parameters

Parameter Type, modifiers and default Purpose
$context string $context Package context object or package name according to the declared type.
$root string $root Operation input; the exact use, validation and propagation are shown in the implementation trace.

Return expressions (including local callbacks): $context . '@' . hash('sha256', realpath($root) ?: rtrim($root, DIRECTORY_SEPARATOR)).

Implementation, validation guards and interaction order
private static function key(string $context, string $root): string
    {
        return $context . '@' . hash('sha256', realpath($root) ?: rtrim($root, DIRECTORY_SEPARATOR));
    }

Related types

Clone this wiki locally