Search in sources :

Example 11 with FifoEvictionPolicy

use of org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy in project ignite by apache.

the class GridIndexingWithNoopSwapSelfTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    disco.setIpFinder(ipFinder);
    c.setDiscoverySpi(disco);
    CacheConfiguration<?, ?> cc = defaultCacheConfiguration();
    cc.setCacheMode(PARTITIONED);
    cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    cc.setRebalanceMode(SYNC);
    cc.setNearConfiguration(new NearCacheConfiguration());
    FifoEvictionPolicy plc = new FifoEvictionPolicy();
    plc.setMaxSize(1000);
    cc.setEvictionPolicy(plc);
    cc.setOnheapCacheEnabled(true);
    cc.setBackups(1);
    cc.setAtomicityMode(TRANSACTIONAL);
    cc.setIndexedTypes(Integer.class, ObjectValue.class);
    c.setCacheConfiguration(cc);
    return c;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) FifoEvictionPolicy(org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration)

Example 12 with FifoEvictionPolicy

use of org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy in project ignite by apache.

the class IgniteCacheP2pUnmarshallingNearErrorTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    if (cfg.isClientMode() == null || !cfg.isClientMode()) {
        cfg.getCacheConfiguration()[0].setEvictionPolicy(new FifoEvictionPolicy(1));
        cfg.getCacheConfiguration()[0].setOnheapCacheEnabled(true);
    }
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) FifoEvictionPolicy(org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy)

Example 13 with FifoEvictionPolicy

use of org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy in project ignite by apache.

the class GridCacheEvictionEventAbstractTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration() throws Exception {
    IgniteConfiguration c = super.getConfiguration();
    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    disco.setIpFinder(ipFinder);
    c.setDiscoverySpi(disco);
    CacheConfiguration cc = defaultCacheConfiguration();
    cc.setCacheMode(cacheMode());
    cc.setAtomicityMode(atomicityMode());
    cc.setEvictionPolicy(new FifoEvictionPolicy());
    cc.setOnheapCacheEnabled(true);
    c.setCacheConfiguration(cc);
    c.setIncludeEventTypes(EVT_CACHE_ENTRY_EVICTED, EVT_TASK_FAILED, EVT_TASK_FINISHED, EVT_JOB_MAPPED);
    return c;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) FifoEvictionPolicy(org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 14 with FifoEvictionPolicy

use of org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy in project ignite by apache.

the class GridCacheConfigurationConsistencySelfTest method testPartitionedOnlyAttributesIgnoredForReplicated.

/**
     * @throws Exception If failed.
     */
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.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.setNearEvictionPolicy(new FifoEvictionPolicy());
            cfg.setNearConfiguration(nearCfg);
            return null;
        }
    };
    startGrid(2);
}
Also used : FifoEvictionPolicy(org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration) LruEvictionPolicy(org.apache.ignite.cache.eviction.lru.LruEvictionPolicy)

Example 15 with FifoEvictionPolicy

use of org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy in project ignite by apache.

the class GridCacheDhtEvictionNearReadersSelfTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    disco.setIpFinder(ipFinder);
    cfg.setDiscoverySpi(disco);
    CacheConfiguration cacheCfg = defaultCacheConfiguration();
    cacheCfg.setCacheMode(PARTITIONED);
    cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    cacheCfg.setRebalanceMode(SYNC);
    cacheCfg.setAtomicityMode(atomicityMode());
    cacheCfg.setBackups(1);
    FifoEvictionPolicy plc = new FifoEvictionPolicy();
    plc.setMaxSize(10);
    cacheCfg.setEvictionPolicy(plc);
    cacheCfg.setOnheapCacheEnabled(true);
    NearCacheConfiguration nearCfg = new NearCacheConfiguration();
    FifoEvictionPolicy nearPlc = new FifoEvictionPolicy();
    nearPlc.setMaxSize(10);
    nearCfg.setNearEvictionPolicy(nearPlc);
    cacheCfg.setNearConfiguration(nearCfg);
    cfg.setCacheConfiguration(cacheCfg);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) FifoEvictionPolicy(org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration)

Aggregations

FifoEvictionPolicy (org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy)25 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)8 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)8 NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)7 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)7 Ignite (org.apache.ignite.Ignite)5 LruEvictionPolicy (org.apache.ignite.cache.eviction.lru.LruEvictionPolicy)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Random (java.util.Random)1 TreeSet (java.util.TreeSet)1 Cache (javax.cache.Cache)1 Factory (javax.cache.configuration.Factory)1 Duration (javax.cache.expiry.Duration)1 IgniteCache (org.apache.ignite.IgniteCache)1 SqlFieldsQuery (org.apache.ignite.cache.query.SqlFieldsQuery)1 GridCacheAlwaysEvictionPolicy (org.apache.ignite.internal.processors.cache.GridCacheAlwaysEvictionPolicy)1 PA (org.apache.ignite.internal.util.typedef.PA)1 Transaction (org.apache.ignite.transactions.Transaction)1