@Override public CacheEvictionConfig getEvictionConfig() { final CacheEvictionConfig evictionConfig = super.getEvictionConfig(); if (evictionConfig == null) { return null; } return evictionConfig.getAsReadOnly(); }
@Override public CacheEvictionConfig getEvictionConfig() { final CacheEvictionConfig evictionConfig = super.getEvictionConfig(); if (evictionConfig == null) { return null; } return evictionConfig.getAsReadOnly(); }
/** * Validates the given {@link CacheConfig}. * * @param cacheConfig the {@link CacheConfig} to check * @param mergePolicyProvider the {@link CacheMergePolicyProvider} to resolve merge policy classes */ public static void checkCacheConfig(CacheConfig cacheConfig, CacheMergePolicyProvider mergePolicyProvider) { checkCacheConfig(cacheConfig.getInMemoryFormat(), cacheConfig.getEvictionConfig(), cacheConfig.getMergePolicy(), cacheConfig, mergePolicyProvider); }
/** * Validates the given {@link CacheConfig}. * * @param cacheConfig the {@link CacheConfig} to check * @param mergePolicyProvider the {@link CacheMergePolicyProvider} to resolve merge policy classes */ public static void checkCacheConfig(CacheConfig cacheConfig, CacheMergePolicyProvider mergePolicyProvider) { checkCacheConfig(cacheConfig.getInMemoryFormat(), cacheConfig.getEvictionConfig(), cacheConfig.getMergePolicy(), cacheConfig, mergePolicyProvider); }
@Setup public void setup() { value = new byte[valueSize]; Random random = new Random(); random.nextBytes(value); CacheManager cacheManager = createCacheManager(targetInstance); cache = (ICache<Object, Object>) cacheManager.getCache(name); CacheConfig<Object, Object> config = cache.getConfiguration(CacheConfig.class); logger.info(name + ": " + cache.getName() + " config: " + config); configuredMaxSize = config.getEvictionConfig().getSize(); // we are explicitly using a random key so that all participants of the test do not put keys 0...max // the size of putAllMap is not guarantied to be configuredMaxSize / 2 as keys are random for (int i = 0; i < configuredMaxSize / 2; i++) { putAllMap.put(random.nextInt(), value); } if (configuredMaxSize < 1000) { toleranceFactor = TOLERANCE_FACTOR_SMALL; } else if (configuredMaxSize < 10000) { toleranceFactor = TOLERANCE_FACTOR_MEDIUM; } else { toleranceFactor = TOLERANCE_FACTOR_LARGE; } estimatedMaxSize = (int) (configuredMaxSize * toleranceFactor); }
System.out.println("async backup count: " + cacheConfig.getAsyncBackupCount()); EvictionConfig evictionConfig = cacheConfig.getEvictionConfig(); System.out.println("max-size: " + evictionConfig.getSize()); System.out.println("max-size-policy: " + evictionConfig.getMaximumSizePolicy());
cacheConfig.getEvictionConfig() .setEvictionPolicy(EvictionPolicy.valueOf(properties.getProperty(JCACHE_EVICTION_POLICY_PROPERTY_KEY))); cacheConfig.getEvictionConfig() .setMaximumSizePolicy(EvictionConfig.MaxSizePolicy .valueOf(properties.getProperty(JCACHE_EVICTION_MAX_SIZE_POLICY_PROPERTY_KEY))); cacheConfig.getEvictionConfig() .setSize(Integer.valueOf(properties.getProperty(JCACHE_EVICTION_SIZE_PROPERTY_KEY)));
cacheConfig.getEvictionConfig() .setEvictionPolicy(EvictionPolicy.valueOf(properties.getProperty(JCACHE_EVICTION_POLICY_PROPERTY_KEY))); cacheConfig.getEvictionConfig() .setMaximumSizePolicy(EvictionConfig.MaxSizePolicy .valueOf(properties.getProperty(JCACHE_EVICTION_MAX_SIZE_POLICY_PROPERTY_KEY))); cacheConfig.getEvictionConfig() .setSize(Integer.valueOf(properties.getProperty(JCACHE_EVICTION_SIZE_PROPERTY_KEY)));
CacheConfig cacheConfig = cache.getConfiguration(CacheConfig.class); EvictionConfig evictionConfig = cacheConfig.getEvictionConfig(); System.out.println("cache configured with eviction -> size:" + evictionConfig.getSize() + " policy:" + evictionConfig.getEvictionPolicyType());
out.writeObject(new LegacyCacheEvictionConfig(config.getEvictionConfig()));
out.writeObject(new LegacyCacheEvictionConfig(config.getEvictionConfig()));
this.evictionConfig = cacheConfig.getEvictionConfig(); if (evictionConfig == null) { throw new IllegalStateException("Eviction config cannot be null!");
this.evictionConfig = cacheConfig.getEvictionConfig(); if (evictionConfig == null) { throw new IllegalStateException("Eviction config cannot be null!");
target.setBackupCount(getBackupCount()); target.setDisablePerEntryInvalidationEvents(isDisablePerEntryInvalidationEvents()); target.setEvictionConfig(getEvictionConfig()); target.setHotRestartConfig(getHotRestartConfig()); target.setInMemoryFormat(getInMemoryFormat());
target.setBackupCount(getBackupCount()); target.setDisablePerEntryInvalidationEvents(isDisablePerEntryInvalidationEvents()); target.setEvictionConfig(getEvictionConfig()); target.setHotRestartConfig(getHotRestartConfig()); target.setInMemoryFormat(getInMemoryFormat());