▲ | maxbond 9 hours ago | |||||||||||||
A TTL doesn't really tell you if it's stale though. It gives you an upper bound on how long it can have been stale. But something becomes stale when the underlying resource is written to, which can happen an hour or an instant after you cache it. You should probably evict it when the write comes in. In my mind, it's for evicting things that aren't in use (to free up memory). | ||||||||||||||
▲ | motorest 9 hours ago | parent [-] | |||||||||||||
> A TTL doesn't really tell you if it's stale though (...) Non-sequitur,and imaterial to the discussion. > You should probably evict it when the write comes in. No. This is only required if memory is maxed out and there is no more room to cache your entry. Otherwise you are risking cache misses by evicting entries that are still relatively hot. | ||||||||||||||
|