Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Default LRU cache does not always guarantee to limit the size under maximum #3507
It looks to me that the default LRU MapCache does not always guarantee to limit the cache size under the preset cache size maximum limit.
Currently, the cache eviction happens when a new cache entry is inserted and the insertion cause the cache size to exceed its maximum. In this case, the cache would remove only 1 entry(the least recently used) from the existing map. However, it doesn't check if the cache size is below maximum after removal. This can cause cache size to grow slowly to an unexpected number under some designated workload.