Menu
Back to Discussions

When should you invalidate the cache and when should you just set a time-to-live (TTL), you know?

Esi Nkrumah
Esi Nkrumah
·2450 views
hey everyone, been thinking a lot about caching strategies lately. we're using Redis for a lot of our caching, and for most things, setting a Time-To-Live (TTL) is straightforward. but for some data, its tricky. like, when a user updates their profile, should we aggressively invalidate that specific cache key, or just let the TTL expire? invalidating feels safer for fresh data, but its more complex to manage. letting it expire is simpler but means stale data for a bit. what are your thoughts or best practices on this trade-off?
40 comments

Comments

Loading comments...