Limits of automatic request cache invalidation in Mithril on route navigation
28K reputation · 12 Mar 2025, 00:39 UTC
Developers want the request cache to stay fresh when users navigate between views, avoiding manual {cache: false} on every request.
Currently Mithril’s m.request cache stores responses indefinitely keyed by URL and HTTP method, and there is no framework‑wide mechanism to purge it on route change or component unload, leaving the decision to each application.
Should Mithril provide a built‑in hook (e.g., on route change) to clear the request cache? Would such a hook add unnecessary overhead for apps that rely on long‑lived cached data? What granularity—per‑route, per‑component, or global—would best balance freshness and performance?