private static void validateMetadataCache(Cache<?, ?> cache, String indexName) { Configuration configuration = cache.getCacheConfiguration(); if (configuration.memory().isEvictionEnabled()) { throw log.evictionNotAllowedInMetadataCache(indexName, cache.getName()); } if (configuration.persistence().usingStores() && !configuration.persistence().preload()) { throw log.preloadNeededIfPersistenceIsEnabledForMetadataCache(indexName, cache.getName()); } }
private static void validateMetadataCache(Cache<?, ?> cache, String indexName) { Configuration configuration = cache.getCacheConfiguration(); if (configuration.memory().isEvictionEnabled()) { throw log.evictionNotAllowedInMetadataCache(indexName, cache.getName()); } if (configuration.persistence().usingStores() && !configuration.persistence().preload()) { throw log.preloadNeededIfPersistenceIsEnabledForMetadataCache(indexName, cache.getName()); } }
private static void validateMetadataCache(Cache<?, ?> cache, String indexName) { Configuration configuration = cache.getCacheConfiguration(); if (configuration.eviction().strategy().isEnabled()) { throw log.evictionNotAllowedInMetadataCache(indexName, cache.getName()); } if (configuration.persistence().usingStores() && !configuration.persistence().preload()) { throw log.preloadNeededIfPersistenceIsEnabledForMetadataCache(indexName, cache.getName()); } }
protected void doPreloadingTest(Configuration preloadingCfg, String cacheName) throws Exception { assertTrue("Preload not enabled for preload test", preloadingCfg.persistence().preload()); cm.defineConfiguration(cacheName, preloadingCfg); Cache<String, String> preloadingCache = getCache(cm, cacheName); AdvancedCacheLoader preloadingCacheLoader = (AdvancedCacheLoader) TestingUtil.getCacheLoader(preloadingCache); assert preloadingCache.getCacheConfiguration().persistence().preload(); assert preloadingCache.getCacheConfiguration().persistence().preload(); c = preloadingCache.getAdvancedCache().getDataContainer(); assertEquals(4, c.size());
public void testPreloadAndExpiry() { assert cache.getCacheConfiguration().persistence().preload(); cache.put("k1", "v"); cache.put("k2", "v", 111111, TimeUnit.MILLISECONDS); cache.put("k3", "v", -1, TimeUnit.MILLISECONDS, 222222, TimeUnit.MILLISECONDS); cache.put("k4", "v", 333333, TimeUnit.MILLISECONDS, 444444, TimeUnit.MILLISECONDS); assertCacheEntry(cache, "k1", "v", -1, -1); assertCacheEntry(cache, "k2", "v", 111111, -1); assertCacheEntry(cache, "k3", "v", -1, 222222); assertCacheEntry(cache, "k4", "v", 333333, 444444); cache.stop(); cache.start(); cl = getAdvancedLoadWriteStore(); assertCacheEntry(cache, "k1", "v", -1, -1); assertCacheEntry(cache, "k2", "v", 111111, -1); assertCacheEntry(cache, "k3", "v", -1, 222222); assertCacheEntry(cache, "k4", "v", 333333, 444444); }
protected void doPreloadingTestWithEviction(Configuration preloadingCfg, String cacheName) throws Exception { assertTrue("Preload not enabled for preload with eviction test", preloadingCfg.persistence().preload()); assertTrue("Eviction not enabled for preload with eviction test", preloadingCfg.memory().isEvictionEnabled()); preloadingCache.getCacheConfiguration().persistence().preload()); assertNotInCacheAndStore(preloadingCache, preloadingCacheLoader, "k1", "k2", "k3", "k4"); preloadingCache.getCacheConfiguration().persistence().preload());
ExceptionTrackerInterceptor interceptor = getInterceptor(cache); assertTrue("Preload should be enabled.", cache.getCacheConfiguration().persistence().preload()); assertTrue("Async Store should be enabled.", cache.getCacheConfiguration().persistence().usingAsyncStore()); assertTrue("Preload should be enabled after restart.", cache.getCacheConfiguration().persistence().preload()); assertTrue("Async Store should be enabled after restart.", cache.getCacheConfiguration().persistence().usingAsyncStore());
public void testPreloadAndExpiry() { ConfigurationBuilder cb = TestCacheManagerFactory.getDefaultCacheConfiguration(false); createCacheStoreConfig(cb.persistence(), true); cacheManager.defineConfiguration("testPreloadAndExpiry", cb.build()); Cache<String, Object> cache = cacheManager.getCache("testPreloadAndExpiry"); cache.start(); assert cache.getCacheConfiguration().persistence().preload(); cache.put("k1", wrap("k1", "v")); cache.put("k2", wrap("k2", "v"), 111111, TimeUnit.MILLISECONDS); cache.put("k3", wrap("k3", "v"), -1, TimeUnit.MILLISECONDS, 222222, TimeUnit.MILLISECONDS); cache.put("k4", wrap("k4", "v"), 333333, TimeUnit.MILLISECONDS, 444444, TimeUnit.MILLISECONDS); assertCacheEntry(cache, "k1", "v", -1, -1); assertCacheEntry(cache, "k2", "v", 111111, -1); assertCacheEntry(cache, "k3", "v", -1, 222222); assertCacheEntry(cache, "k4", "v", 333333, 444444); cache.stop(); cache.start(); assertCacheEntry(cache, "k1", "v", -1, -1); assertCacheEntry(cache, "k2", "v", 111111, -1); assertCacheEntry(cache, "k3", "v", -1, 222222); assertCacheEntry(cache, "k4", "v", 333333, 444444); }
public void testPreloadStoredAsBinary() { ConfigurationBuilder cb = TestCacheManagerFactory.getDefaultCacheConfiguration(false); createCacheStoreConfig(cb.persistence(), true).memory().storageType(StorageType.BINARY); cacheManager.defineConfiguration("testPreloadStoredAsBinary", cb.build()); Cache<String, Pojo> cache = cacheManager.getCache("testPreloadStoredAsBinary"); cache.start(); assert cache.getCacheConfiguration().persistence().preload(); assertEquals(StorageType.BINARY, cache.getCacheConfiguration().memory().storageType()); cache.put("k1", new Pojo(1)); cache.put("k2", new Pojo(2), 111111, TimeUnit.MILLISECONDS); cache.put("k3", new Pojo(3), -1, TimeUnit.MILLISECONDS, 222222, TimeUnit.MILLISECONDS); cache.put("k4", new Pojo(4), 333333, TimeUnit.MILLISECONDS, 444444, TimeUnit.MILLISECONDS); cache.stop(); cache.start(); assertEquals(4, cache.entrySet().size()); assertEquals(new Pojo(1), cache.get("k1")); assertEquals(new Pojo(2), cache.get("k2")); assertEquals(new Pojo(3), cache.get("k3")); assertEquals(new Pojo(4), cache.get("k4")); }
assertTrue(c.persistence().preload()); assertTrue(!c.persistence().passivation()); assertEquals(1, c.persistence().stores().size());