HHH-7150 added Cache#evictAllRegions
This commit is contained in:
parent
4a898c5524
commit
0ba9a3a289
|
@ -185,4 +185,9 @@ public interface Cache {
|
|||
* Evict data from all query regions.
|
||||
*/
|
||||
public void evictQueryRegions();
|
||||
|
||||
/**
|
||||
* Evict all data from the cache.
|
||||
*/
|
||||
public void evictAllRegions();
|
||||
}
|
||||
|
|
|
@ -354,4 +354,13 @@ public class CacheImpl implements CacheImplementor {
|
|||
public RegionFactory getRegionFactory() {
|
||||
return regionFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void evictAllRegions() {
|
||||
evictCollectionRegions();
|
||||
evictDefaultQueryRegion();
|
||||
evictEntityRegions();
|
||||
evictQueryRegions();
|
||||
evictNaturalIdRegions();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -557,6 +557,7 @@ public class EntityManagerFactoryImpl implements HibernateEntityManagerFactory {
|
|||
}
|
||||
|
||||
public void evictAll() {
|
||||
// Evict only the "JPA cache", which is purely defined as the entity regions.
|
||||
sessionFactory.getCache().evictEntityRegions();
|
||||
// TODO : if we want to allow an optional clearing of all cache data, the additional calls would be:
|
||||
// sessionFactory.getCache().evictCollectionRegions();
|
||||
|
|
|
@ -441,11 +441,7 @@ public abstract class BaseCoreFunctionalTestCase extends BaseUnitTestCase {
|
|||
|
||||
protected void cleanupCache() {
|
||||
if ( sessionFactory != null ) {
|
||||
sessionFactory.getCache().evictCollectionRegions();
|
||||
sessionFactory.getCache().evictDefaultQueryRegion();
|
||||
sessionFactory.getCache().evictEntityRegions();
|
||||
sessionFactory.getCache().evictQueryRegions();
|
||||
sessionFactory.getCache().evictNaturalIdRegions();
|
||||
sessionFactory.getCache().evictAllRegions();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue