Garbage collection when Ehcache is used for hibernate second level cache

让人想犯罪 __ 提交于 2019-12-12 04:32:18

问题


When Ehcache is used for hibernate second level cache, do the objects in echache get garbage collected by the JVM?


回答1:


They will eventually get garbage collected...

But given you say "the objects in ehcache", I'd be tempted to say... it depends. i.e. for as long as Ehcache deems the data "valuable" and you only have on-heap storage configured, it'll remain on heap. Depending on the version you run and the cache's topology, when not considered "hot" enough anymore to remain on-heap (i.e. as close as possible to your application's code), ehcache will either send the entry to another tier (offheap, disk) or just dispose of it (while it could also already be present elsewhere: offheap, disk, TSA; and as such remain available through the Cache's API, while not being on-heap anymore), making it eligible for GC'ing.



来源:https://stackoverflow.com/questions/24346428/garbage-collection-when-ehcache-is-used-for-hibernate-second-level-cache

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!