A slightly stale value is an old cache entry served to a reader who accepts it, so that a key written all the time is not loaded again for every read.
A get that misses makes the application server go to the database, fetch the key and populate the cache. A post is liked constantly, so its key is updated constantly and kicked out of the cache. A reader does not care if the likes go from 3,507 to 3,508.
So the client says how old a value it accepts. At 8:03 a like count from the last two minutes is fine. A profile picture is wanted within 30 seconds.
A delete does not remove the entry:
- The application server updates the database and deletes the key from the cache.
- The cache marks the entry as old and keeps it.
- A reader who accepts data five minutes old is served the old entry.
- When the cache is out of space, stale entries are kicked out first.
Nobody decides beforehand which data may be stale.