Does anyone know how Vercel manages cache eviction?
I have a use case where I really want actual TTL behavior with Vercel cache. I want to specify a period of time, after which NEW DATA are fetched, as opposed to just displaying stale, cached data, while background revalidation happens. The details are below, though they're not terribly relevant to the question.
https://twitter.com/AdamRackis/status/1680232416760287233
The workaround I think would work would be to somehow store some sort of timestamp cookie, and incorporate that into my cache key. So my cache key would be something like
user-123-transactions-993726153, were the number on the end is the timestamp that would increase over time. I'd set some sort of revalidate value, but over that value, I would just generate a new timestamp, and put that in my cache key when I call the api endpoint.
My question is, should I be worried about these cached entries piling up in Vercel's cache (and costing me money)? Or is there some mechanism whereby entries past the revalidate window are removed, automatically?
Finding info on this has been incredibly frustrating.
0 Replies