Search in sources :

Example 16 with LruEvictionPolicy

use of org.apache.ignite.cache.eviction.lru.LruEvictionPolicy in project ignite by apache.

the class GridCacheObjectToStringSelfTest method testLocalCacheLruEvictionPolicy.

/** @throws Exception If failed. */
public void testLocalCacheLruEvictionPolicy() throws Exception {
    cacheMode = LOCAL;
    evictionPlc = new LruEvictionPolicy();
    checkToString();
}
Also used : LruEvictionPolicy(org.apache.ignite.cache.eviction.lru.LruEvictionPolicy)

Example 17 with LruEvictionPolicy

use of org.apache.ignite.cache.eviction.lru.LruEvictionPolicy in project ignite by apache.

the class GridCacheObjectToStringSelfTest method testReplicatedCacheLruEvictionPolicy.

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

Example 18 with LruEvictionPolicy

use of org.apache.ignite.cache.eviction.lru.LruEvictionPolicy in project ignite by apache.

the class GridCacheObjectToStringSelfTest method testColocatedCacheLruEvictionPolicy.

/** @throws Exception If failed. */
public void testColocatedCacheLruEvictionPolicy() throws Exception {
    cacheMode = PARTITIONED;
    nearEnabled = false;
    evictionPlc = new LruEvictionPolicy();
    checkToString();
}
Also used : LruEvictionPolicy(org.apache.ignite.cache.eviction.lru.LruEvictionPolicy)

Example 19 with LruEvictionPolicy

use of org.apache.ignite.cache.eviction.lru.LruEvictionPolicy in project ignite by apache.

the class GridCacheAbstractNodeRestartSelfTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
    ((TcpCommunicationSpi) c.getCommunicationSpi()).setSharedMemoryPort(-1);
    // Discovery.
    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    disco.setIpFinder(ipFinder);
    disco.setSocketTimeout(30_000);
    disco.setAckTimeout(30_000);
    disco.setNetworkTimeout(30_000);
    c.setDiscoverySpi(disco);
    CacheConfiguration ccfg = cacheConfiguration();
    if (evict) {
        LruEvictionPolicy plc = new LruEvictionPolicy();
        plc.setMaxSize(100);
        ccfg.setEvictionPolicy(plc);
        ccfg.setOnheapCacheEnabled(true);
    }
    c.setCacheConfiguration(ccfg);
    return c;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi) LruEvictionPolicy(org.apache.ignite.cache.eviction.lru.LruEvictionPolicy)

Example 20 with LruEvictionPolicy

use of org.apache.ignite.cache.eviction.lru.LruEvictionPolicy in project ignite by apache.

the class IgniteCachePutRetryAbstractSelfTest method cacheConfiguration.

/**
     * @param evict If {@code true} adds eviction policy.
     * @param store If {@code true} adds cache store.
     * @return Cache configuration.
     * @throws Exception If failed.
     */
@SuppressWarnings("unchecked")
protected CacheConfiguration cacheConfiguration(boolean evict, boolean store) throws Exception {
    CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
    cfg.setAtomicityMode(atomicityMode());
    cfg.setWriteSynchronizationMode(FULL_SYNC);
    cfg.setBackups(1);
    cfg.setRebalanceMode(SYNC);
    if (evict) {
        LruEvictionPolicy plc = new LruEvictionPolicy();
        plc.setMaxSize(100);
        cfg.setEvictionPolicy(plc);
        cfg.setOnheapCacheEnabled(true);
    }
    if (store) {
        cfg.setCacheStoreFactory(new TestStoreFactory());
        cfg.setWriteThrough(true);
    }
    return cfg;
}
Also used : CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) LruEvictionPolicy(org.apache.ignite.cache.eviction.lru.LruEvictionPolicy)

Aggregations

LruEvictionPolicy (org.apache.ignite.cache.eviction.lru.LruEvictionPolicy)23 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)15 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)11 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)9 NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)6 Ignite (org.apache.ignite.Ignite)2 IgniteCache (org.apache.ignite.IgniteCache)2 FifoEvictionPolicy (org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy)2 CacheStoreAdapter (org.apache.ignite.cache.store.CacheStoreAdapter)2 AtomicConfiguration (org.apache.ignite.configuration.AtomicConfiguration)2 TcpCommunicationSpi (org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi)2 ArrayList (java.util.ArrayList)1 LinkedHashSet (java.util.LinkedHashSet)1 Callable (java.util.concurrent.Callable)1 ThreadLocalRandom (java.util.concurrent.ThreadLocalRandom)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 CacheException (javax.cache.CacheException)1 FactoryBuilder (javax.cache.configuration.FactoryBuilder)1 Duration (javax.cache.expiry.Duration)1