Start here. This is the direct spoken answer to practice first.
Why this question matters
Invalidation must connect a committed source-of-truth change to every cached representation derived from it. Timing, retry behavior, and dependency ownership decide how long stale data can survive after a write.
The simplest approach is to write the database first, then delete or update the relevant cache key. The next read will miss and reload the fresh value. This works well when the app knows exactly which keys depend on the changed data. If many keys are affected, I would prefer a simpler key model, short TTL, versioned keys, or a background invalidation path.