Add an in-memory cache in front of every devianter call: DD, search, deviation, gruser, gallery, favourites, comments. Keyed by endpoint plus arguments. Bounded by entry count or bytes. Singleflight so concurrent requests for one key share a single upstream call. Per-endpoint TTLs, in config with defaults on the order of: DD and search a few minutes, deviations longer, comments shorter.
This is the item the TODO at app/cache.go:3 names. It makes feed polling
and /api/random close to free.
Design first: cache interface, key derivation, TTL config keys, eviction,
what the hit/miss log looks like. Write the spec to
docs/superpowers/specs/ and review before code.
Files: new app/apicache.go, call sites in app/wrapper.go,
app/api.go, app/api_json.go, config in app/config.go, docs in
SETUP.md.
Verify: unit tests for TTL expiry, singleflight, and bounded size. Two sequential requests for one page make one upstream call.
Roadmap item 1.1, size L. See ROADMAP.md.
closed by commit 90ffcd3e9d by cmc: Serve DeviantArt API responses from the cache
2026-09-11 15:13 UTC