Perform cache maintenance in a separate thread #2239
Labels
Enhancements
Increases software capabilities beyond original client specifications
Roadmap:Vector Database/GenAI
Project-wide roadmap label
v2.19.0
Description
For the NativeMemoryCacheManager, we allow users to enable an "expirary" time setting, so that cache entries that arent touched for some duration, get marked as expired and are then evicted.
However, the problem is that the guava cache does not maintain a separate thread that can perform this maintenance. Instead it will typically perform this maintenance on writes and sometimes on reads. See https://github.com/google/guava/wiki/CachesExplained#timed-eviction. Thus, if you are not touching the cache for awhile, entries may be expired but not get evicted. Thus, resources are not freed.
The Guava team recommends creating a separate thread that will call cache.cleanUp() to explicitly perform maintenance. This will ensure that the time-based evictions happen as one would expect.
The text was updated successfully, but these errors were encountered: