pingora
pingora copied to clipboard
Add RTCache::remove
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.
ps: happy to work on a PR