← ClaudeAtlas

nette-cachinglisted

Invoke before writing or reviewing code that uses nette/caching. Covers the Cache object and namespaces, load() with a generator callback, save(), remove(), clean(), the dependency array (Cache::Expire, Cache::Tags, Cache::Files, Cache::Items, Cache::Priority, Cache::Sliding, Cache::Callbacks), the Journal requirement for tags and priorities, bulkLoad(), output capture, storages (FileStorage, MemcachedStorage, SQLiteStorage, MemoryStorage, DevNullStorage) and the {cache} Latte tag. Also trigger for cache.storage or cache.journal in NEON, invalidation by tag, cache stampede, or disabling the cache in tests. Not for the Latte template cache or the DI container cache, which are separate mechanisms.
nette/agent-plugins · ★ 44 · AI & Automation · score 81
Install: claude install-skill nette/agent-plugins
## Nette Caching ```shell composer require nette/caching ``` ### Dependency Constants – Exact Names Since 3.1.3 the constants are **PascalCase**; the UPPER_CASE names survive as deprecated aliases, which makes wrong guesses fail in confusing ways. ```php Cache::Expire // 'expire' – NOT Cache::Expiration (that constant does not exist) Cache::Sliding // 'sliding' Cache::Tags // 'tags' Cache::Files // 'files' – resolved with filemtime(), so a relative path depends on the CWD; use absolute Cache::Items // 'items' – other cache keys Cache::Constants // 'consts' Cache::Callbacks // 'callbacks' – [callable, ...args], must return true to stay valid. // The callable is SERIALIZED with the entry, so a closure is // a fatal ("Serialization of 'Closure' is not allowed") – // use a function name or [Class::class, 'method']. Cache::Priority // 'priority' Cache::All // 'all' – clean() only ``` `Cache::EXPIRATION` **does** exist (deprecated alias of `Expire`); `Cache::Expiration` does **not** and is a fatal `Undefined constant`. There is likewise no `forget()`, no `delete()` and no `has()` – removal is `remove($key)`, which is just `save($key, null)`. ### Reading and Writing ```php $cache = new Nette\Caching\Cache($storage, 'my-namespace'); // Nette\Caching\Storage is autowired $sub = $cache->derive('images');