当前位置: 首页>>代码示例>>Java>>正文


Java LruEvictionPolicy类代码示例

本文整理汇总了Java中org.apache.ignite.cache.eviction.lru.LruEvictionPolicy的典型用法代码示例。如果您正苦于以下问题:Java LruEvictionPolicy类的具体用法?Java LruEvictionPolicy怎么用?Java LruEvictionPolicy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LruEvictionPolicy类属于org.apache.ignite.cache.eviction.lru包,在下文中一共展示了LruEvictionPolicy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testCacheCreateLeak

import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy; //导入依赖的package包/类
/**
 * @throws Exception If failed.
 */
public void testCacheCreateLeak() throws Exception {
    final Ignite ignite = grid();

    GridTestUtils.runMultiThreaded(new IgniteInClosure<Integer>() {
        @Override public void apply(Integer idx) {
            for (int i = 0; i < 100; i++) {
                CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
                ccfg.setName("cache-" + idx + "-" + i);
                ccfg.setEvictionPolicy(new LruEvictionPolicy(1000));
                ccfg.setOnheapCacheEnabled(true);

                IgniteCache<Object, Object> cache = ignite.createCache(ccfg);

                for (int k = 0; k < 5000; k++)
                    cache.put(k, new byte[1024]);

                ignite.destroyCache(cache.getName());
            }
        }
    }, 5, "cache-thread");
}
 
开发者ID:apache,项目名称:ignite,代码行数:25,代码来源:CacheConfigurationLeakTest.java

示例2: getConfiguration

import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy; //导入依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    CacheConfiguration<Integer, Integer> ccfg =
        new CacheConfiguration<Integer, Integer>()
            .setName("config")
            .setAtomicityMode(CacheAtomicityMode.ATOMIC)
            .setBackups(0) // No need for backup, just load from the store if needed
            .setCacheStoreFactory(new CacheStoreFactory())
            .setOnheapCacheEnabled(true)
            .setEvictionPolicy(new LruEvictionPolicy(100))
            .setNearConfiguration(new NearCacheConfiguration<Integer, Integer>()
            .setNearEvictionPolicy(new LruEvictionPolicy<Integer, Integer>()));

    ccfg.setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.MINUTES, 1)))
        .setReadThrough(true)
        .setWriteThrough(false);

    cfg.setCacheConfiguration(ccfg);

    return cfg;
}
 
开发者ID:apache,项目名称:ignite,代码行数:24,代码来源:GridCachePartitionEvictionDuringReadThroughSelfTest.java

示例3: getNearCacheConfig

import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy; //导入依赖的package包/类
@Nullable
@SuppressWarnings("unchecked")
private NearCacheConfiguration getNearCacheConfig(ServerCacheType type, L2CacheConfig config) {

  if (type.equals(ServerCacheType.QUERY) || config.getNearSize() == null) {
    return null;

  } else {
    NearCacheConfiguration near = new NearCacheConfiguration();
    near.setNearEvictionPolicy(new LruEvictionPolicy(config.getNearSize()));
    return  near;
  }
}
 
开发者ID:ebean-orm,项目名称:ebean-ignite,代码行数:14,代码来源:ConfigManager.java

示例4: getConfiguration

import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy; //导入依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration() throws Exception {
    IgniteConfiguration cfg = super.getConfiguration();

    CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);

    ccfg.setName("cache-1");
    ccfg.setEvictionPolicy(new LruEvictionPolicy(10));
    ccfg.setOnheapCacheEnabled(true);
    ccfg.setIndexedTypes(Integer.class, TestData.class);

    cfg.setCacheConfiguration(ccfg);

    return cfg;
}
 
开发者ID:apache,项目名称:ignite,代码行数:16,代码来源:CacheQueryEvictDataLostTest.java

示例5: testAtomicOffheapEviction

import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy; //导入依赖的package包/类
/**
 * @throws Exception If failed.
 */
public void testAtomicOffheapEviction() throws Exception {
    CacheConfiguration<Object, Object> ccfg = cacheConfiguration(PARTITIONED,
        ATOMIC,
        new LruEvictionPolicy<>(10),
        false);

    randomOperations(ccfg);
}
 
开发者ID:apache,项目名称:ignite,代码行数:12,代码来源:CacheRandomOperationsMultithreadedTest.java

示例6: testAtomicOffheapEvictionIndexing

import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy; //导入依赖的package包/类
/**
 * @throws Exception If failed.
 */
public void testAtomicOffheapEvictionIndexing() throws Exception {
    CacheConfiguration<Object, Object> ccfg = cacheConfiguration(PARTITIONED,
        ATOMIC,
        new LruEvictionPolicy<>(10),
        true);

    randomOperations(ccfg);
}
 
开发者ID:apache,项目名称:ignite,代码行数:12,代码来源:CacheRandomOperationsMultithreadedTest.java

示例7: testTxOffheapEviction

import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy; //导入依赖的package包/类
/**
 * @throws Exception If failed.
 */
public void testTxOffheapEviction() throws Exception {
    CacheConfiguration<Object, Object> ccfg = cacheConfiguration(PARTITIONED,
        TRANSACTIONAL,
        new LruEvictionPolicy<>(10),
        false);

    randomOperations(ccfg);
}
 
开发者ID:apache,项目名称:ignite,代码行数:12,代码来源:CacheRandomOperationsMultithreadedTest.java

示例8: testTxOffheapEvictionIndexing

import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy; //导入依赖的package包/类
/**
 * @throws Exception If failed.
 */
public void testTxOffheapEvictionIndexing() throws Exception {
    CacheConfiguration<Object, Object> ccfg = cacheConfiguration(PARTITIONED,
        TRANSACTIONAL,
        new LruEvictionPolicy<>(10),
        true);

    randomOperations(ccfg);
}
 
开发者ID:apache,项目名称:ignite,代码行数:12,代码来源:CacheRandomOperationsMultithreadedTest.java

示例9: testPartitionedOnlyAttributesIgnoredForReplicated

import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy; //导入依赖的package包/类
/**
 * @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.setNearEvictionPolicyFactory(new FifoEvictionPolicyFactory<>());
            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.setNearEvictionPolicyFactory(new FifoEvictionPolicyFactory<>());
            nearCfg.setNearEvictionPolicy(new FifoEvictionPolicy());

            cfg.setNearConfiguration(nearCfg);

            return null;
        }
    };

    startGrid(2);
}
 
开发者ID:apache,项目名称:ignite,代码行数:39,代码来源:GridCacheConfigurationConsistencySelfTest.java

示例10: getConfiguration

import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy; //导入依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();

    discoSpi.setIpFinder(IP_FINDER);

    cfg.setDiscoverySpi(discoSpi);

    LruEvictionPolicy evictionPolicy = new LruEvictionPolicy<>();
    evictionPolicy.setMaxSize(LRU_MAX_SIZE);

    CacheConfiguration<String, byte[]> cacheCfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
    cacheCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
    cacheCfg.setCacheMode(CacheMode.PARTITIONED);
    cacheCfg.setBackups(1);
    cacheCfg.setReadFromBackup(true);
    cacheCfg.setEvictionPolicy(evictionPolicy);
    cacheCfg.setOnheapCacheEnabled(true);
    cacheCfg.setStatisticsEnabled(true);

    cacheCfg.setWriteThrough(false);
    cacheCfg.setReadThrough(false);

    cacheCfg.setCacheStoreFactory(new FactoryBuilder.SingletonFactory(new Storage()));

    cfg.setCacheConfiguration(cacheCfg);

    return cfg;
}
 
开发者ID:apache,项目名称:ignite,代码行数:32,代码来源:IgniteCacheLoadRebalanceEvictionSelfTest.java

示例11: testLocalCacheLruEvictionPolicy

import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy; //导入依赖的package包/类
/** @throws Exception If failed. */
public void testLocalCacheLruEvictionPolicy() throws Exception {
    cacheMode = LOCAL;
    evictionPlc = new LruEvictionPolicy();

    checkToString();
}
 
开发者ID:apache,项目名称:ignite,代码行数:8,代码来源:GridCacheObjectToStringSelfTest.java

示例12: testReplicatedCacheLruEvictionPolicy

import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy; //导入依赖的package包/类
/** @throws Exception If failed. */
public void testReplicatedCacheLruEvictionPolicy() throws Exception {
    cacheMode = REPLICATED;
    evictionPlc = new LruEvictionPolicy();

    checkToString();
}
 
开发者ID:apache,项目名称:ignite,代码行数:8,代码来源:GridCacheObjectToStringSelfTest.java

示例13: testPartitionedCacheLruEvictionPolicy

import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy; //导入依赖的package包/类
/** @throws Exception If failed. */
public void testPartitionedCacheLruEvictionPolicy() throws Exception {
    cacheMode = PARTITIONED;
    nearEnabled = true;
    evictionPlc = new LruEvictionPolicy();

    checkToString();
}
 
开发者ID:apache,项目名称:ignite,代码行数:9,代码来源:GridCacheObjectToStringSelfTest.java

示例14: testColocatedCacheLruEvictionPolicy

import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy; //导入依赖的package包/类
/** @throws Exception If failed. */
public void testColocatedCacheLruEvictionPolicy() throws Exception {
    cacheMode = PARTITIONED;
    nearEnabled = false;
    evictionPlc = new LruEvictionPolicy();

    checkToString();
}
 
开发者ID:apache,项目名称:ignite,代码行数:9,代码来源:GridCacheObjectToStringSelfTest.java

示例15: createNearPolicyFactory

import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy; //导入依赖的package包/类
/** {@inheritDoc} */
@Override protected Factory<LruEvictionPolicy<String, String>> createNearPolicyFactory(int nearMax) {
    LruEvictionPolicyFactory<String, String> plc = new LruEvictionPolicyFactory<>();

    plc.setMaxSize(nearMax);
    plc.setBatchSize(plcBatchSize);

    return plc;
}
 
开发者ID:apache,项目名称:ignite,代码行数:10,代码来源:LruEvictionPolicyFactorySelfTest.java


注:本文中的org.apache.ignite.cache.eviction.lru.LruEvictionPolicy类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。