Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Ability to trigger a lookup call deliberately #42

@ithinkicancode

Description

@ithinkicancode

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:

  1. refresh a cache entry to its most up-to-date value from our persistence store (it could have changed since the last retrieval)
  2. we simply want to extend the TTL of an entry by repopulating it
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions