Devcraft\Cache\FileCachePool implements Psr\Cache\CacheItemPoolInterface.
| Class | Role |
|---|---|
FileCachePool |
Filesystem pool |
CacheItem |
Cache item |
InvalidArgument |
Invalid key / argument |
Constructor: new FileCachePool(string $baseDir, ?int $defaultTtlSeconds = null).
nullor0default TTL → items without explicit expiry do not expire.- Positive TTL → applied when the item still uses the default expiry (
expiresAfter/expiresAtnot called).
- Allowed: letters, digits, and
/as a namespace separator (extension beyond strict PSR-6 reserved list). - Forbidden:
{}()\@:and... - File path:
{baseDir}/{key}.cache(/→ subdirectory). - Envelope JSON:
{ "e": expiryUnix|null, "f": "j"|"s", "v": value }.
$pool->clearNamespace('Translation'); // deletes Translation/* keysNot part of PSR-6; provided for DevCraft-style typed caches.
DevCraft\Core\Cache\CacheControl is a thin facade: setCache($type, $name, $data) maps to key {type}/{name} and delegates to FileCachePool. Prefer CacheControl::pool() for new code.