zio-cache
zio-cache copied to clipboard
Ability to iterate/query items in the cache
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:
- Any query only represents a snapshot of the cache at a particular moment.
- We probably shouldn't keep additional copies of data to hold this snapshot just for this purpose
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).