Problem
Frequently executed queries (dashboard stats, navigation counts, config lookups) hit SQLite on every request. For read-heavy pages, caching would improve performance significantly.
Proposal
Syntax
page /dashboard
query stats: select count(*) as users from user
cache 5m
query recent: select title from post order by created desc limit 5
cache 1m
Behavior
cache DURATION stores query results in memory for the specified duration
- Cache key: SQL string + bound parameter values
- Invalidation: automatic on any mutation (INSERT/UPDATE/DELETE) to the referenced tables
- Manual invalidation: not needed for v1 (automatic is good enough)
Implementation
- In-memory cache (sync.Map or similar)
- TTL-based expiration
- Table-level invalidation (parse SQL to detect referenced tables)
Non-goals (for now)
- Redis or external cache
- Per-user cache isolation
- Cache warming on startup
Problem
Frequently executed queries (dashboard stats, navigation counts, config lookups) hit SQLite on every request. For read-heavy pages, caching would improve performance significantly.
Proposal
Syntax
Behavior
cache DURATIONstores query results in memory for the specified durationImplementation
Non-goals (for now)