/** * {@inheritDoc} */ public void clear() { parentCache.clear(); }
@Override public void clear() { this.cacheStore.with(this.classloader).clear(); }
/** * {@inheritDoc} */ public void clearCache() { cache.withFlags(Flag.CACHE_MODE_LOCAL).clear(); onClearCache(); }
@Override public void removeAll() throws CacheException { try { if (!putValidator.beginInvalidatingRegion()) { log.failedInvalidateRegion(region.getName()); } cache.clear(); } finally { putValidator.endInvalidatingRegion(); } }
@After public void cleanup() { cleanup.forEach(Runnable::run); cleanup.clear(); if (localRegion != null) localRegion.getCache().clear(); if (remoteRegion != null) remoteRegion.getCache().clear(); node1Exception = node2Exception = null; node1Failure = node2Failure = null; TIME_SERVICE.advance(1); // There might be invalidation from the previous test }
public void testKeySetIsEmptyAfterLocalClear() throws Exception { cache.put(1, "v1"); tm().begin(); try { cache.getAdvancedCache().withFlags(Flag.CACHE_MODE_LOCAL).clear(); assertTrue(cache.keySet().isEmpty()); } finally { tm().commit(); } }
public void testValuesIsEmptyAfterLocalClear() throws Exception { cache.put(1, "v1"); tm().begin(); try { cache.getAdvancedCache().withFlags(Flag.CACHE_MODE_LOCAL).clear(); assertTrue(cache.values().isEmpty()); } finally { tm().commit(); } }
public void testEntrySetIsEmptyAfterLocalClear() throws Exception { cache.put(1, "v1"); tm().begin(); try { cache.getAdvancedCache().withFlags(Flag.CACHE_MODE_LOCAL).clear(); assertTrue(cache.entrySet().isEmpty()); } finally { tm().commit(); } }
@Test(description="Verifies the caches can be reused after a Directory close") public void testCacheReuse() throws IOException { testIndexWritingAndFinding(); cache(0, "lucene").getAdvancedCache().withFlags(Flag.SKIP_INDEXING).clear(); testIndexWritingAndFinding(); }
public void testSizeAfterLocalClear() throws Exception { cache.put(1, "v1"); tm().begin(); try { cache.getAdvancedCache().withFlags(Flag.CACHE_MODE_LOCAL).clear(); assertEquals(0, cache.size()); } finally { tm().commit(); } }
public void testValuesSizeAfterLocalClear() throws Exception { cache.put(1, "v1"); tm().begin(); try { cache.getAdvancedCache().withFlags(Flag.CACHE_MODE_LOCAL).clear(); assertEquals(0, cache.values().size()); } finally { tm().commit(); } } }
public void testKeySetSizeAfterLocalClear() throws Exception { cache.put(1, "v1"); tm().begin(); try { cache.getAdvancedCache().withFlags(Flag.CACHE_MODE_LOCAL).clear(); assertEquals(0, cache.keySet().size()); } finally { tm().commit(); } }
public void testEntrySetSizeAfterLocalClear() throws Exception { cache.put(1, "v1"); tm().begin(); try { cache.getAdvancedCache().withFlags(Flag.CACHE_MODE_LOCAL).clear(); assertEquals(0, cache.entrySet().size()); } finally { tm().commit(); } }
public void testLocalOnlyClear() { AdvancedCache<String, String> cache1 = advancedCache(0,"replication"); AdvancedCache<String, String> cache2 = advancedCache(1,"replication"); cache1.withFlags(CACHE_MODE_LOCAL).put("key", "value1"); cache2.withFlags(CACHE_MODE_LOCAL).put("key", "value2"); assert cache1.get("key").equals("value1"); assert cache2.get("key").equals("value2"); cache1.withFlags(CACHE_MODE_LOCAL).clear(); assert cache1.get("key") == null; assert cache2.get("key") != null; assert cache2.get("key").equals("value2"); } }
public void testLocalOnlyClear() { AdvancedCache<String, String> cache1 = advancedCache(0,"invalidation"); AdvancedCache<String, String> cache2 = advancedCache(1,"invalidation"); cache1.withFlags(CACHE_MODE_LOCAL).put("key", "value1"); cache2.withFlags(CACHE_MODE_LOCAL).put("key", "value2"); assert cache1.get("key").equals("value1"); assert cache2.get("key").equals("value2"); cache1.withFlags(CACHE_MODE_LOCAL).clear(); assert cache1.get("key") == null; assert cache2.get("key") != null; assert cache2.get("key").equals("value2"); }
public void testClear() { AdvancedCache<String, String> cache1 = advancedCache(0,"replication"); AdvancedCache<String, String> cache2 = advancedCache(1,"replication"); cache1.withFlags(CACHE_MODE_LOCAL).put("key", "value1"); cache2.withFlags(CACHE_MODE_LOCAL).put("key", "value2"); assert cache1.get("key").equals("value1"); assert cache2.get("key").equals("value2"); cache1.clear(); assert cache1.get("key") == null; assert cache2.get("key") == null; }
public void testSize(Method m) { TestSizeResponse sizeStart = client().size(); assertStatus(sizeStart, Success); assertEquals(0, sizeStart.size); for (int i = 0; i < 20; i++) client().assertPut(m, "k-" + i, "v-" + i); // Clear contents from memory advancedCache.withFlags(Flag.SKIP_CACHE_STORE).clear(); TestSizeResponse sizeEnd = client().size(); assertStatus(sizeEnd, Success); assertEquals(20, sizeEnd.size); }
@Before public void insertAndClearCache() throws Exception { region = TEST_SESSION_ACCESS.getRegion(sessionFactory(), Item.class.getName()); entityCache = region.getCache(); timeout = TestRegionFactoryProvider.load().findRegionFactory(sessionFactory().getCache()) .getPendingPutsCacheConfiguration().expiration().maxIdle(); Item item = new Item("my item", "Original item"); withTxSession(s -> s.persist(item)); entityCache.clear(); assertEquals("Cache is not empty", Collections.EMPTY_SET, entityCache.keySet()); itemId = item.getId(); log.info("Insert and clear finished"); }