use of org.apache.ignite.lang.IgniteBiInClosure in project ignite by apache.
the class CacheTtlAbstractSelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
ccfg.setCacheMode(cacheMode());
ccfg.setAtomicityMode(atomicityMode());
LruEvictionPolicy plc = new LruEvictionPolicy();
plc.setMaxSize(MAX_CACHE_SIZE);
ccfg.setEvictionPolicy(plc);
ccfg.setOnheapCacheEnabled(true);
ccfg.setIndexedTypes(Integer.class, Integer.class);
ccfg.setBackups(2);
ccfg.setWriteSynchronizationMode(FULL_SYNC);
ccfg.setRebalanceMode(SYNC);
ccfg.setCacheStoreFactory(singletonFactory(new CacheStoreAdapter() {
@Override
public void loadCache(IgniteBiInClosure clo, Object... args) {
for (int i = 0; i < SIZE; i++) clo.apply(i, i);
}
@Override
public Object load(Object key) throws CacheLoaderException {
return key;
}
@Override
public void write(Cache.Entry entry) throws CacheWriterException {
// No-op.
}
@Override
public void delete(Object key) throws CacheWriterException {
// No-op.
}
}));
ccfg.setExpiryPolicyFactory(FactoryBuilder.factoryOf(new TouchedExpiryPolicy(new Duration(MILLISECONDS, DEFAULT_TIME_TO_LIVE))));
cfg.setCacheConfiguration(ccfg);
((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
return cfg;
}
Aggregations