Any Java caches that can limit memory usage of in-memory cache, not just instance count?

后端 未结 8 2441
后悔当初
后悔当初 2021-02-14 00:08

I am looking for a simple in-memory (and in-process) cache for short-term caching of query data (but short-term meaning beyond request/response, i.e. session boundary). EhCache

8条回答
  •  灰色年华
    2021-02-14 00:35

    It's possible to define a meaningful measure for the memory usage of a cache. You could compute the : "retained size". Unfortunately computing the retained size is roughly as costly as a full GC, and it's therefore probably not an option. In certain JVM languages (clojure?) you could theoretically make sure that no objects in the cache would be referenced from outside objects and then you could monitor the real size of the cache.

提交回复
热议问题