static: headings, table, list, task list, quote, link, code block

Edge cache or in-memory cache

Both work. The right pick depends on how often the feed changes and how many regions you serve. A quick comparison:

StrategyBest forTrade-off
Edge cacheMany regions, read-heavyStale for up to the TTL
In-memoryOne region, low trafficCold on every deploy
BothMixed trafficTwo places to invalidate

A typed example

TypeScript
type Feed = { items: { id: string; title: string }[]; updatedAt: number };
export async function readFeed(load: () => Promise<Feed>, ttl = 60_000) {
const cached = cache.get("feed");
if (cached && Date.now() - cached.updatedAt < ttl) return cached;
const fresh = await load();
cache.set("feed", fresh);
return fresh;
}

Things to check before shipping:

  1. Set a stale-while-revalidate window so readers never wait on a refresh.
  2. Key the cache by locale, not just by path.
  3. Log the hit rate for a week; then tune the TTL.
  • Decide on a TTL
  • Add a purge hook for editors

A cache you cannot purge is a bug waiting for a deadline.

More background lives in the sample caching guide.

streaming: only the last block re-renders

0/106

inline code and emphasis

Use readFeed() with a short TTL, then tune it. Avoid global shared keys.