Hi!
I'm using Astro 7 Route Cache with the Vercel adapter and have been testing it in production for several days.
I understand the purpose of maxAge, swr, and tags, and I've confirmed that tag invalidation works correctly.
For example, after calling invalidate(), I can observe:
HIT → STALE → HITwhich matches the expected behavior.
However, I have a question about physical cache retention.
For example:
Astro.cache.set({ maxAge: 60 * 60 * 24 * 365,});Even with a very long maxAge, I often observe that pages become MISS after several hours (or after a period without traffic), resulting in a MISS response instead of HIT.
I'm trying to understand how Route Cache retention works on Vercel.
Specifically:
- Is cache eviction based on access frequency?
- Are
maxAgeand physical cache retention completely independent? - Does enabling
swraffect cache retention, or does it only control stale-while-revalidate behavior? - Is the eviction policy documented anywhere?
I couldn't find any documentation describing how Route Cache entries are physically retained or evicted on Vercel, so I'd appreciate any clarification.
In practice, I found that Astro's prefetch often has a bigger impact on perceived performance than Route Cache, so I'm trying to better understand how Route Cache is intended to be used in production.
I'm not reporting a bug—I'm just trying to better understand how Route Cache behaves in production so I can choose appropriate maxAge and swr values.
Thanks!