Search in sources :

Example 1 with SortedEvictionPolicy

use of org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicy in project ignite by apache.

the class GridCacheConcurrentEvictionsSelfTest method testConcurrentPutsSortedLocal.

/**
 * @throws Exception If failed.
 */
@Test
public void testConcurrentPutsSortedLocal() throws Exception {
    mode = LOCAL;
    SortedEvictionPolicy plc = new SortedEvictionPolicy();
    plc.setMaxSize(1000);
    this.plc = plc;
    warmUpPutsCnt = SF.applyLB(100_000, 10_000);
    iterCnt = SF.applyLB(100_000, 10_000);
    checkConcurrentPuts();
}
Also used : SortedEvictionPolicy(org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicy) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Example 2 with SortedEvictionPolicy

use of org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicy in project ignite by apache.

the class EvictionPolicies method sorted.

public static void sorted() {
    // tag::sorted[]
    CacheConfiguration cacheCfg = new CacheConfiguration();
    cacheCfg.setName("cacheName");
    // Enabling on-heap caching for this distributed cache.
    cacheCfg.setOnheapCacheEnabled(true);
    // Set the maximum cache size to 1 million (default is 100,000).
    cacheCfg.setEvictionPolicyFactory(() -> new SortedEvictionPolicy(1000000));
    IgniteConfiguration cfg = new IgniteConfiguration();
    cfg.setCacheConfiguration(cacheCfg);
// end::sorted[]
}
Also used : SortedEvictionPolicy(org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicy) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 3 with SortedEvictionPolicy

use of org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicy in project ignite by apache.

the class SortedEvictionPolicyPerformanceTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    CacheConfiguration ccfg = defaultCacheConfiguration();
    ccfg.setCacheMode(CacheMode.PARTITIONED);
    ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
    ccfg.setNearConfiguration(null);
    SortedEvictionPolicy plc = new SortedEvictionPolicy();
    plc.setMaxSize(MAX_SIZE);
    ccfg.setEvictionPolicy(plc);
    ccfg.setOnheapCacheEnabled(true);
    cfg.setPeerClassLoadingEnabled(false);
    cfg.setCacheConfiguration(ccfg);
    return cfg;
}
Also used : SortedEvictionPolicy(org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicy) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Aggregations

SortedEvictionPolicy (org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicy)3 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)2 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)2 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)1 Test (org.junit.Test)1