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.
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.