Search in sources :

Example 16 with FifoEvictionPolicy

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

the class GridCacheObjectToStringSelfTest method testReplicatedCacheFifoEvictionPolicy.

/** @throws Exception If failed. */
public void testReplicatedCacheFifoEvictionPolicy() throws Exception {
    cacheMode = REPLICATED;
    evictionPlc = new FifoEvictionPolicy();
    checkToString();
}
Also used : FifoEvictionPolicy(org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy)

Example 17 with FifoEvictionPolicy

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

the class GridCachePartitionedEvictionSelfTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
    c.getTransactionConfiguration().setTxSerializableEnabled(true);
    TcpDiscoverySpi spi = new TcpDiscoverySpi();
    spi.setIpFinder(ipFinder);
    c.setDiscoverySpi(spi);
    CacheConfiguration cc = defaultCacheConfiguration();
    cc.setCacheMode(PARTITIONED);
    cc.setWriteSynchronizationMode(FULL_SYNC);
    FifoEvictionPolicy plc = new FifoEvictionPolicy();
    plc.setMaxSize(EVICT_CACHE_SIZE);
    cc.setEvictionPolicy(plc);
    cc.setOnheapCacheEnabled(true);
    FifoEvictionPolicy nearPlc = new FifoEvictionPolicy();
    nearPlc.setMaxSize(EVICT_CACHE_SIZE);
    cc.getNearConfiguration().setNearEvictionPolicy(nearPlc);
    // We set 1 backup explicitly.
    cc.setBackups(1);
    c.setCacheConfiguration(cc);
    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 18 with FifoEvictionPolicy

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

the class ClusterNodeMetricsSelfTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    TcpDiscoverySpi spi = new TcpDiscoverySpi();
    spi.setIpFinder(IP_FINDER);
    cfg.setDiscoverySpi(spi);
    cfg.setCacheConfiguration();
    cfg.setMetricsUpdateFrequency(500);
    CacheConfiguration<Integer, Object> ccfg = defaultCacheConfiguration();
    ccfg.setName(CACHE_NAME);
    ccfg.setStatisticsEnabled(true);
    FifoEvictionPolicy plc = new FifoEvictionPolicy();
    plc.setMaxMemorySize(MAX_VALS_AMOUNT * VAL_SIZE);
    plc.setMaxSize(0);
    ccfg.setEvictionPolicy(plc);
    ccfg.setOnheapCacheEnabled(true);
    return cfg.setCacheConfiguration(ccfg);
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) FifoEvictionPolicy(org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 19 with FifoEvictionPolicy

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

the class GridCachePartitionedMultiThreadedPutGetSelfTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
    c.getTransactionConfiguration().setTxSerializableEnabled(true);
    CacheConfiguration cc = defaultCacheConfiguration();
    cc.setCacheMode(PARTITIONED);
    cc.setBackups(1);
    cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    FifoEvictionPolicy plc = new FifoEvictionPolicy();
    plc.setMaxMemorySize(1000);
    cc.setEvictionPolicy(plc);
    cc.setOnheapCacheEnabled(true);
    cc.setAtomicityMode(TRANSACTIONAL);
    NearCacheConfiguration nearCfg = new NearCacheConfiguration();
    nearCfg.setNearEvictionPolicy(new GridCacheAlwaysEvictionPolicy());
    cc.setNearConfiguration(nearCfg);
    c.setCacheConfiguration(cc);
    TcpDiscoverySpi spi = new TcpDiscoverySpi();
    spi.setIpFinder(ipFinder);
    c.setDiscoverySpi(spi);
    return c;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) GridCacheAlwaysEvictionPolicy(org.apache.ignite.internal.processors.cache.GridCacheAlwaysEvictionPolicy) 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) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 20 with FifoEvictionPolicy

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

the class GridCacheEmptyEntriesAbstractSelfTest method testFifo.

/**
     * Tests FIFO eviction policy.
     *
     * @throws Exception If failed.
     */
public void testFifo() throws Exception {
    FifoEvictionPolicy plc = new FifoEvictionPolicy();
    plc.setMaxSize(50);
    this.plc = plc;
    FifoEvictionPolicy nearPlc = new FifoEvictionPolicy();
    nearPlc.setMaxSize(50);
    this.nearPlc = nearPlc;
    checkPolicy();
}
Also used : FifoEvictionPolicy(org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy)

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