@Override public void clear() { cache.clear(); }
@Override public void clear() { cache.clear(); }
@Override public void clear() { cache.clear(); }
cache.clear(); System.out.println("Clear cache");
public void run() { NearCacheConfig nearCacheConfig = createNearCacheConfig() .setInvalidateOnChange(true); CacheConfig<Integer, String> cacheConfig = createCacheConfig(); cacheConfig.setDisablePerEntryInvalidationEvents(true); ICache<Integer, String> clientCache1 = createCacheWithNearCache(cacheConfig, nearCacheConfig); ICache<Integer, String> clientCache2 = getCacheWithNearCache(nearCacheConfig); // put records to remote cache through client-1 putRecordsToCacheOnClient1(clientCache1); // get records from remote cache through client-2 getRecordsFromCacheOnClient2(clientCache2); // get records from Near Cache on client-2 getRecordsFromNearCacheOnClient2(clientCache2); // update records in remote cache through client-1 updateRecordsInCacheOnClient1(clientCache1); // wait a little for invalidation events to be sent in batch sleepSeconds(2 * INVALIDATION_EVENT_FLUSH_FREQ_SECONDS); // get old records from Near Cache on client-2 (because we have disabled per entry invalidation event) getStillOldRecordsFromNearCacheOnClient2(clientCache2); // clear cache through client-1 clientCache1.clear(); // wait a little for invalidation events to be sent in batch sleepSeconds(2 * INVALIDATION_EVENT_FLUSH_FREQ_SECONDS); // try to get records from Near Cache and can't find any, since they are invalidated from Near Cache on client-2 // due to clear() on client-1, because it's a full-flush operation and triggers invalidation even though // per entry invalidation event is disabled cantFindAnyRecordFromNearCacheOnClient2(clientCache2); shutdown(); }