The repository of the query side: a read model that writes keep current, not a cache left to expire.
A CQRS-style read side for BEAR.Sunday: the results of cacheable GETs are kept as read models. On a miss, onGet builds one on demand; the commands that change it refresh or purge it. A resource declares this with attributes and AOP does the rest - storing, answering conditional requests, and invalidating. By default an entry lives until a write invalidates it; a TTL is available for data that may simply go stale.
- The resource graph is the dependency graph: a child taken in with
#[Embed]that ran before the parent was stored becomes a dependency of the parent, cached or not, and#[DependsOn]ties a resource to the URIs its rows name,#[DependsOn(uri: 'app://self/article?id={id}', key: 'articles')]with$this->body['articles'] = [['id' => 1, ...], ['id' => 2, ...]], without embedding each one. A row that names its list with#[Link(rel: 'collection', href: 'app://self/articles')]on itsonGet()purges the list when it is written, so the list needs no declaration for its rows. - Writes invalidate: a command (
onPut,onPatch, ...) invalidates its own resource, and what else it changes with#[Purge],#[Refresh]or#[RefreshCache], rather than waiting for expiry. - One tag crosses every layer: the origin cache, the validator behind
304 Not Modified, and the CDN'sSurrogate-Keyare invalidated by the same tags. - Three uses of a child: a per-user hole (
#[DonutCache]), a hole rebuilt on events (#[CacheableResponse]), and material the page reads. - Verifiable: the semantic log records each store, hit, dependency and invalidation.
A cache attribute declares the response shared with every visitor: put per-user values in a non-cacheable #[DonutCache] hole.
- Cache manual: English / 日本語
- Reading the Log (en / ja): every word the log can contain, and how to read a session
- Why the Log Records Everything (en / ja): the design rationale, the cost measurements, and why recording is off by default
- What the Log Proves (en / ja): the questions the log answers, and its declared boundaries
- LLM documentation
- Agent skills, via
/plugin install bear-skills: bear-cache-log and bear-cache-gate
