Clear L2 Cache

I want to clear the cache data from the second level cache by calling the method below:

sessionFactory.getCache().evictEntityRegions();

I just want to know if there is any harm in this? For example: what happens if I try to clear the cache in the middle of a transaction?

Thanks in advance.

+4
source share
1 answer

No, there is no harm in that. In fact, the same thing happens when you configure the cache provider to evict / expire items based on a specific eviction / expiration policy.

+2
source

Source: https://habr.com/ru/post/1669943/


All Articles