pingora icon indicating copy to clipboard operation
pingora copied to clipboard

Add RTCache::remove

Open theduke opened this issue 1 year ago • 1 comments

What is the problem your feature solves, or the need it fulfills?

The RTCache currently does not provide a way to remove keys.

My concrete need is pruning stale values and forcing a fresh lookup based on external events.

Describe the solution you'd like

Add RTCache::remove().

One design consideration is if a removal should interact with currently running lookups. If a lookup is in progress, remove() may have unintuitive behaviour, because the key will be re-populated, but might still end up as stale because the lookup was started earlier.

The recommendation is to make the remove method async and wait for running lookups to finish by acquiring the lock.

theduke avatar Nov 17 '24 12:11 theduke

ps: happy to work on a PR

theduke avatar Nov 19 '24 07:11 theduke