zio-cache icon indicating copy to clipboard operation
zio-cache copied to clipboard

Ability to iterate/query items in the cache

Open ithinkicancode opened this issue 3 years ago • 1 comments

Motivation

Currently there is no easy way to iterate through or query against the items in the cache. There might be cases where you would like to do that (debugging comes to mind).

Considerations

Maybe we can provide either an iterator or a query/filter interface to users for this purpose. However, we'll need to take potential performance impact and data consistency into account:

  1. Any query only represents a snapshot of the cache at a particular moment.
  2. We probably shouldn't keep additional copies of data to hold this snapshot just for this purpose

ithinkicancode avatar Aug 26 '21 03:08 ithinkicancode

It would be especially nice to iterate the items in the exact order as they appear in 'KeySet', so it is possible to remove/invalidate items exactly like when size > capacity (remove least recently used first), but then at arbitrary moments (e.g. to alleviate memory pressure).

fourth44 avatar Jul 20 '23 13:07 fourth44