use of org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicyFactory in project ignite by apache.
the class GridCacheConfigurationConsistencySelfTest method testPartitionedOnlyAttributesIgnoredForReplicated.
/**
* @throws Exception If failed.
*/
@Test
public void testPartitionedOnlyAttributesIgnoredForReplicated() throws Exception {
cacheEnabled = true;
cacheMode = REPLICATED;
initCache = new C1<CacheConfiguration, Void>() {
@Override
public Void apply(CacheConfiguration cfg) {
NearCacheConfiguration nearCfg = new NearCacheConfiguration();
nearCfg.setNearEvictionPolicyFactory(new FifoEvictionPolicyFactory<>());
nearCfg.setNearEvictionPolicy(new LruEvictionPolicy());
cfg.setNearConfiguration(nearCfg);
return null;
}
};
startGrid(1);
initCache = new C1<CacheConfiguration, Void>() {
@Override
public Void apply(CacheConfiguration cfg) {
NearCacheConfiguration nearCfg = new NearCacheConfiguration();
nearCfg.setNearEvictionPolicyFactory(new FifoEvictionPolicyFactory<>());
nearCfg.setNearEvictionPolicy(new FifoEvictionPolicy());
cfg.setNearConfiguration(nearCfg);
return null;
}
};
startGrid(2);
}
use of org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicyFactory in project ignite by apache.
the class GridEvictionPolicyMBeansTest method getConfiguration.
/**
* {@inheritDoc}
*
* This implementation adds eviction policies.
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
FifoEvictionPolicyFactory<String, String> plc = new FifoEvictionPolicyFactory<>();
plc.setMaxSize(100);
plc.setBatchSize(10);
plc.setMaxMemorySize(20);
CacheConfiguration cache1 = defaultCacheConfiguration();
cache1.setName("cache1");
cache1.setOnheapCacheEnabled(true);
cache1.setEvictionPolicyFactory(plc);
NearCacheConfiguration ncf = new NearCacheConfiguration<>();
ncf.setNearEvictionPolicyFactory(new LruEvictionPolicyFactory<>(40, 10, 500));
CacheConfiguration cache2 = defaultCacheConfiguration();
cache2.setName("cache2");
cache2.setOnheapCacheEnabled(true);
LruEvictionPolicy lep = new LruEvictionPolicy();
lep.setBatchSize(10);
lep.setMaxMemorySize(125);
lep.setMaxSize(30);
cache2.setEvictionPolicy(lep);
ncf = new NearCacheConfiguration<>();
lep = new LruEvictionPolicy();
lep.setBatchSize(10);
lep.setMaxMemorySize(500);
lep.setMaxSize(40);
ncf.setNearEvictionPolicy(lep);
if (!MvccFeatureChecker.forcedMvcc() || MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.NEAR_CACHE)) {
cache1.setNearConfiguration(ncf);
cache2.setNearConfiguration(ncf);
}
cfg.setCacheConfiguration(cache1, cache2);
return cfg;
}
Aggregations