简体   繁体   中英

Default Concurrency strategy for Query Cache in Hibernate using ECache

I was wondering about the default concurrency strategy for the Query level caching in Hibernate if we do not provide it explicitly. I have gone through the link https://docs.jboss.org/hibernate/orm/4.0/manual/en-US/html/performance.html#performance-cache but unable to find the exact solution. Any help? Thanks.

SessionFactory object is thread safe, and it manages L2 cache, that's why you can assume that all L2 cache is thread safe. This technique is called instance confinement, you assume that only SessionFactory object instance will operate on L2 cache.

With L1 cache you have make sure that you manage your Session object properly and you not publish it anywhere, as it's not thread safe.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM