-
Notifications
You must be signed in to change notification settings - Fork 41
Description
Motivation
Currently get is the only way to trigger a lookup call, which may or may not happen depending on whether the target entry resides in the cache. However, there are times when we want to:
- refresh a cache entry to its most up-to-date value from our persistence store (it could have changed since the last retrieval)
- we simply want to extend the TTL of an entry by repopulating it
- we want both 1) and 2)
At the moment, we would have to invalidate the entry first then get it again. This is probably not the best way to handle it. For example, a popular item is being requested constantly. If we evict it first then fetch it, during the fetch, we could receive tons of requests for this item. Even though we can handle a Thundering Herd situation, we should avoid it in the first place.
The proposal is that we can trigger an update, which runs in the background. Upon a successful retrieval, we will update the entry with the new value. During the time of retrieval, all incoming requests are served right away without delay.