Recently uses the secondary level cache in my project there
is some issue with it , i wanted to know how can i clear it secondary cache
Asked
Active
Viewed 8,688 times
3

Ashish Chaurasia
- 1,747
- 17
- 23
-
do you want to disable cache/ clear the cache at some point of time ? – sanbhat Jun 13 '13 at 12:58
-
Your problem is very similar to [this one](http://stackoverflow.com/questions/2461063/springhibernateehcache-how-to-clear-all-cache) – gma Jun 13 '13 at 13:02
-
sessionFactory.getCache().evictEntityRegions(); try this – shreyansh jogi Jun 13 '13 at 13:02
1 Answers
8
If you want to clear cache in code you can use:
sf.getCache().evictEntityRegions()
sf.getCache().evictCollectionRegions()
sf.getCache().evictDefaultQueryRegion()
sf.getCache().evictQueryRegions()
where sf
means session factory

michal
- 1,796
- 1
- 13
- 11