本文整理汇总了Java中javax.persistence.Cache.evictAll方法的典型用法代码示例。如果您正苦于以下问题:Java Cache.evictAll方法的具体用法?Java Cache.evictAll怎么用?Java Cache.evictAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.persistence.Cache
的用法示例。
在下文中一共展示了Cache.evictAll方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test
import javax.persistence.Cache; //导入方法依赖的package包/类
@Test
public void test() {
Cache cache = entityManager.getEntityManagerFactory().getCache();
cache.evictAll();
Statistics statistics = ((Session)(entityManager.getDelegate())).getSessionFactory().getStatistics();
statistics.clear();
CommonCourt commonCourt = testPersistenceObjectFactory.createCcCourt(CommonCourtType.APPEAL);
commonCourtRepository.findOne(commonCourt.getId());
commonCourtRepository.findOne(commonCourt.getId());
Assert.assertTrue(cache.contains(CommonCourt.class, commonCourt.getId()));
Assert.assertTrue(cache.contains(CommonCourtDivision.class, commonCourt.getDivisions().get(0).getId()));
Assert.assertTrue(cache.contains(CommonCourtDivision.class, commonCourt.getDivisions().get(1).getId()));
cache.evict(CommonCourt.class);
cache.evict(CommonCourtDivision.class);
Assert.assertFalse(cache.contains(CommonCourt.class, commonCourt.getId()));
Assert.assertFalse(cache.contains(CommonCourtDivision.class, commonCourt.getDivisions().get(0).getId()));
Assert.assertFalse(cache.contains(CommonCourtDivision.class, commonCourt.getDivisions().get(1).getId()));
Assert.assertEquals(5, statistics.getSecondLevelCachePutCount()); // 1 commonCourt + 2 ccDivision + 2 ccDivisionType
Assert.assertEquals(2, statistics.getSecondLevelCacheHitCount());
Assert.assertEquals(0, statistics.getSecondLevelCacheMissCount());
}
示例2: destroy
import javax.persistence.Cache; //导入方法依赖的package包/类
public static void destroy() {
if (emf == null) {
return;
}
Cache cache = emf.getCache();
log.debug("###### EVICT ALL ######");
cache.evictAll();
emf.close();
}
示例3: invoke
import javax.persistence.Cache; //导入方法依赖的package包/类
@Override
public Object invoke(Object... args) {
Cache secondLevelCache = getEntityManagerFactory(args).getCache();
if (secondLevelCache != null) {
secondLevelCache.evictAll();
}
return null;
}
示例4: clearAllCache
import javax.persistence.Cache; //导入方法依赖的package包/类
public DAO<T> clearAllCache() {
Cache cache = entityManager.getEntityManagerFactory().getCache();
cache.evictAll();
return this;
}
示例5: clear
import javax.persistence.Cache; //导入方法依赖的package包/类
/**
* Clear the second level cache
*/
public void clear() {
Cache cache = kbEmf.getCache();
cache.evictAll();
cache = annoEmf.getCache();
cache.evictAll();
cache = miscEmf.getCache();
cache.evictAll();
}