Repository navigation
Internals 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.
use vfs\cache\Cache;
use vfs\cache\enums\ECacheValidation;class ResourceCacheNo own constants, enum cases, traits or property declarations. Inherited members are documented on the parent reference page.
| 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 |
public static function cache(string $context, array $watch, array $content, string $root = PACKAGES): void| 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);
}public static function get(string $context, string $root = PACKAGES): array|bool| 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));
}public static function delete(string $context, string $root = PACKAGES): bool| 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);
}private static function key(string $context, string $root): string| 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));
}AWT Framework Wiki · Home · Installation Guide · Developer Guide · Framework Internals
Philosophy · Architecture · Known discrepancies · Verification
Installation Guide
Developer Guide
- Learning sequence
- First package
- Package structure
- Lifecycle
- Runtimes
- Events and objects
- Routing and controllers
- Views and resources
- Database and models
- Storage and caching
- Configuration and CLI
- Responses and errors
- Extension points
Framework Internals
- Architecture
- Bootstrap
- Packages
- Runtime
- Events and context
- Objects
- HTTP routing and controllers
- Rendering
- Blade integration
- Database
- Models
- Storage and caching
- Settings
- CLI
- Identity and sessions
- Responses
- Errors
- Complete source inventory
Documentation notes