LRU ingestion
For detail pages capped at a byte budget — products, articles, anything that grows unbounded over time. Individually keyed per record, evicted oldest-first once the partition exceeds its configured budget.
- A store already registered via register() — see api/register
- Familiarity with the other three types — see ingestion/snapshot, ingestion/collection-all, ingestion/paginated
Basic usage
ingestionType: 'LRU' and pair it with a cacheStrategy on any channel whose records are individually keyed and too numerous or open-ended to cache all at once.What qualifies as LRU
Two key shapes in IDB
idbKey into two distinct shapes — a root heartbeat key and per-item data keys — and they must never be confused with each other.The root key only ever holds a heartbeat envelope ({ data: true, cachedAt, ttl }) used by the revalidation loop to check freshness with a single read. It's excluded from eviction entirely — only per-item keys are eviction candidates.
Setting a byte budget
maxBytes is the field to set directly. Budget resolution and eviction accounting are computed per resolved (scoped) partition — a 'user'-scoped LRU partition's budget is tracked independently per tenant.Dispatch skips the store for arrays
hydrateState with the whole array — each item is written to IDB individually, and detail pages read their own item directly on mount.Eviction and access tracking
lastAccessedAt are evicted first, fire-and-forget, without blocking the write.Oversized writes are rejected, not silently dropped
If you see a rejected-write warning, your maxBytes is too small for the data you're trying to cache — raise the budget rather than ignoring the warning, since the write silently never lands.
Choosing the right ingestion type
For a single object, see ingestion/snapshot. For bounded arrays, see ingestion/collection-all. For configuring ingestionType and cacheStrategy alongside the rest of a registration, see api/register.