Resource Query Responsibility Segregation (RQRS) is a caching framework for BEAR.Sunday that optimizes performance by separating query and command responsibilities.
Overview
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. - : a cached child taken in with #[Embed] becomes a dependency of the parent. - : a command (onPut, onPatch, ...) invalidates what it changes with #[Purge], #[Refresh] or #[RefreshCache], rather than waiting for expiry. - : the origin cache, the ETag pool behind 304 Not Modified, and the CDN's Surrogate-Key are invalidated by the same tags. - : a per-user hole (#[DonutCache]), a hole rebuilt on events (#[CacheableResponse]), and material the page reads. - : the semantic log records each store, hit, dependency and invalidation.
README
BEAR.QueryRepository
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 cached child taken in with
#[Embed]becomes a dependency of the parent. - Writes invalidate: a command (
onPut,onPatch, …) invalidates what it changes with#[Purge],#[Refresh]or#[RefreshCache], rather than waiting for expiry. - One tag crosses every layer: the origin cache, the ETag pool 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.
Documentation
- 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
Recommended Tools
Try a different keyword or remove a filter.
Install
npx skillfish add bearsunday/bear.queryrepository