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


Java CacheConfiguration.setEvictionPolicy方法代码示例

本文整理汇总了Java中org.apache.ignite.configuration.CacheConfiguration.setEvictionPolicy方法的典型用法代码示例。如果您正苦于以下问题:Java CacheConfiguration.setEvictionPolicy方法的具体用法?Java CacheConfiguration.setEvictionPolicy怎么用?Java CacheConfiguration.setEvictionPolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.ignite.configuration.CacheConfiguration的用法示例。


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

示例1: newCache

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * Create new ML cache if needed.
 */
private IgniteCache<MatrixBlockKey, MatrixBlockEntry> newCache() {
    CacheConfiguration<MatrixBlockKey, MatrixBlockEntry> cfg = new CacheConfiguration<>();

    // Write to primary.
    cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.PRIMARY_SYNC);

    // Atomic transactions only.
    cfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);

    // No eviction.
    cfg.setEvictionPolicy(null);

    // No copying of values.
    cfg.setCopyOnRead(false);

    // Cache is partitioned.
    cfg.setCacheMode(CacheMode.PARTITIONED);

    // Random cache name.
    cfg.setName(CACHE_NAME);

    return Ignition.localIgnite().getOrCreateCache(cfg);
}
 
开发者ID:Luodian,项目名称:Higher-Cloud-Computing-Project,代码行数:27,代码来源:BlockMatrixStorage.java

示例2: newCache

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * Create new ML cache if needed.
 */
private IgniteCache<VectorBlockKey, VectorBlockEntry> newCache() {
    CacheConfiguration<VectorBlockKey, VectorBlockEntry> cfg = new CacheConfiguration<>();

    // Write to primary.
    cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.PRIMARY_SYNC);

    // Atomic transactions only.
    cfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);

    // No eviction.
    cfg.setEvictionPolicy(null);

    // No copying of values.
    cfg.setCopyOnRead(false);

    // Cache is partitioned.
    cfg.setCacheMode(CacheMode.PARTITIONED);

    // Random cache name.
    cfg.setName(CACHE_NAME);

    return Ignition.localIgnite().getOrCreateCache(cfg);
}
 
开发者ID:Luodian,项目名称:Higher-Cloud-Computing-Project,代码行数:27,代码来源:BlockVectorStorage.java

示例3: newCache

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * Create new ML cache if needed.
 */
private IgniteCache<RowColMatrixKey, Double> newCache() {
    CacheConfiguration<RowColMatrixKey, Double> cfg = new CacheConfiguration<>();

    // Write to primary.
    cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.PRIMARY_SYNC);

    // Atomic transactions only.
    cfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);

    // No eviction.
    cfg.setEvictionPolicy(null);

    // No copying of values.
    cfg.setCopyOnRead(false);

    // Cache is partitioned.
    cfg.setCacheMode(CacheMode.PARTITIONED);

    // Random cache name.
    cfg.setName(CACHE_NAME);

    return Ignition.localIgnite().getOrCreateCache(cfg);
}
 
开发者ID:Luodian,项目名称:Higher-Cloud-Computing-Project,代码行数:27,代码来源:SparseDistributedVectorStorage.java

示例4: cacheConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception {
    CacheConfiguration ccfg = super.cacheConfiguration(igniteInstanceName);

    ccfg.setBackups(1);

    if (hasNearCache())
        ccfg.setNearConfiguration(new NearCacheConfiguration());

    FifoEvictionPolicy plc = new FifoEvictionPolicy();
    plc.setMaxSize(HEAP_ENTRIES);

    ccfg.setEvictionPolicy(plc);
    ccfg.setOnheapCacheEnabled(true);

    return ccfg;
}
 
开发者ID:apache,项目名称:ignite,代码行数:18,代码来源:IgniteCachePeekModesAbstractTest.java

示例5: cacheConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @param cacheMode Cache mode.
 * @param atomicityMode Cache atomicity mode.
 * @param evictionPlc Eviction policy.
 * @param indexing Indexing flag.
 * @return Cache configuration.
 */
private CacheConfiguration<Object, Object> cacheConfiguration(
    CacheMode cacheMode,
    CacheAtomicityMode atomicityMode,
    @Nullable  EvictionPolicy<Object, Object> evictionPlc,
    boolean indexing) {
    CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);

    ccfg.setAtomicityMode(atomicityMode);
    ccfg.setCacheMode(cacheMode);
    ccfg.setWriteSynchronizationMode(FULL_SYNC);
    ccfg.setEvictionPolicy(evictionPlc);
    ccfg.setOnheapCacheEnabled(evictionPlc != null);

    if (cacheMode == PARTITIONED)
        ccfg.setBackups(1);

    if (indexing)
        ccfg.setIndexedTypes(TestKey.class, TestData.class);

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

示例6: createCaches

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** */
@Before
public void createCaches() {
    CacheConfiguration configuration = new CacheConfiguration<>();
    configuration.setEvictionPolicy(new FifoEvictionPolicy(1));
    createCache(firstCache, CacheAtomicityMode.TRANSACTIONAL, CacheMode.PARTITIONED, false, 0, configuration);
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:8,代码来源:TransactionIsolationTest.java

示例7: createCaches

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** */
@Before
public void createCaches() {
    CacheConfiguration configuration = new CacheConfiguration<>();
    configuration.setEvictionPolicy(new FifoEvictionPolicy(5));
    createCache(firstCache, TRANSACTIONAL, PARTITIONED, false, 0, configuration);

    configuration = new CacheConfiguration<>();
    configuration.setEvictionPolicy(new FifoEvictionPolicy(101));
    createCache(secondCache, TRANSACTIONAL, PARTITIONED, false, 0, configuration);
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:12,代码来源:EvictionPolicyTest.java

示例8: newCache

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * Create new ML cache if needed.
 */
private IgniteCache<RowColMatrixKey, Map<Integer, Double>> newCache() {
    CacheConfiguration<RowColMatrixKey, Map<Integer, Double>> cfg = new CacheConfiguration<>();

    // Write to primary.
    cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.PRIMARY_SYNC);

    // Atomic transactions only.
    cfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);

    // No eviction.
    cfg.setEvictionPolicy(null);

    // No copying of values.
    cfg.setCopyOnRead(false);

    // Cache is partitioned.
    cfg.setCacheMode(CacheMode.PARTITIONED);

    // TODO: Possibly we should add a fix of https://issues.apache.org/jira/browse/IGNITE-6862 here commented below.
    // cfg.setReadFromBackup(false);

    // Random cache name.
    cfg.setName(CACHE_NAME);

    return Ignition.localIgnite().getOrCreateCache(cfg);
}
 
开发者ID:Luodian,项目名称:Higher-Cloud-Computing-Project,代码行数:30,代码来源:SparseDistributedMatrixStorage.java

示例9: IgniteCacheAdapter

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * Constructor.
 *
 * @param id
 *          Cache id.
 */
@SuppressWarnings("unchecked")
public IgniteCacheAdapter(String id) {
  if (id == null) {
    throw new IllegalArgumentException("Cache instances require an ID");
  }

  CacheConfiguration<Object, Object> cacheCfg = null;

  try {
    DefaultListableBeanFactory factory = new DefaultListableBeanFactory();

    new XmlBeanDefinitionReader(factory).loadBeanDefinitions(new FileSystemResource(new File(CFG_PATH)));

    cacheCfg = (CacheConfiguration<Object, Object>) factory.getBean("templateCacheCfg");

    cacheCfg.setEvictionPolicy(null);
    cacheCfg.setCacheLoaderFactory(null);
    cacheCfg.setCacheWriterFactory(null);

    // overrides template cache name with the specified id.
    cacheCfg.setName(id);
  } catch (NoSuchBeanDefinitionException | BeanDefinitionStoreException e) {
    // initializes the default cache.
    log.warn("Initializing the default cache. Consider properly configuring '" + CFG_PATH + "' instead.");
    log.trace("" + e);

    cacheCfg = new CacheConfiguration<>(id);
  }

  cache = ignite.getOrCreateCache(cacheCfg);

  this.id = id;
}
 
开发者ID:mybatis,项目名称:ignite-cache,代码行数:40,代码来源:IgniteCacheAdapter.java

示例10: getConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(igniteInstanceName);

    TransactionConfiguration txCfg = c.getTransactionConfiguration();

    txCfg.setDefaultTxConcurrency(txConcurrency);
    txCfg.setDefaultTxIsolation(txIsolation);
    txCfg.setTxSerializableEnabled(true);

    CacheConfiguration cc = defaultCacheConfiguration();

    cc.setCacheMode(cacheMode());
    cc.setAtomicityMode(TRANSACTIONAL);

    cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);

    cc.setEvictionPolicy(plc);
    cc.setOnheapCacheEnabled(true);

    if (testStore != null) {
        cc.setCacheStoreFactory(singletonFactory(testStore));
        cc.setReadThrough(true);
        cc.setWriteThrough(true);
        cc.setLoadPreviousValue(true);
    }
    else
        cc.setCacheStoreFactory(null);

    c.setCacheConfiguration(cc);

    TcpDiscoverySpi disco = new TcpDiscoverySpi();

    disco.setIpFinder(ipFinder);

    c.setDiscoverySpi(disco);

    return c;
}
 
开发者ID:apache,项目名称:ignite,代码行数:41,代码来源:GridCacheEmptyEntriesAbstractSelfTest.java

示例11: getConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的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

示例12: defaultCacheConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @return New cache configuration with modified defaults.
 */
public static CacheConfiguration defaultCacheConfiguration() {
    CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);

    cfg.setAtomicityMode(TRANSACTIONAL);
    cfg.setNearConfiguration(new NearCacheConfiguration());
    cfg.setWriteSynchronizationMode(FULL_SYNC);
    cfg.setEvictionPolicy(null);

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

示例13: getConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的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

示例14: getConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@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.setAtomicityMode(TRANSACTIONAL);
    cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    cacheCfg.setBackups(0);
    cacheCfg.setEvictionPolicy(null);
    cacheCfg.setNearConfiguration(null);

    cacheCfg.setIndexedTypes(
        Integer.class, Integer.class
    );

    cfg.setCacheConfiguration(cacheCfg);

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

示例15: getOrCreate

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * Get or create cache for training context.
 *
 * @param ignite Ignite instance.
 * @param <D> Class storing information about continuous regions.
 * @return Cache for training context.
 */
public static <D extends ContinuousRegionInfo> IgniteCache<UUID, TrainingContext<D>> getOrCreate(Ignite ignite) {
    CacheConfiguration<UUID, TrainingContext<D>> cfg = new CacheConfiguration<>();

    cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);

    cfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);

    cfg.setEvictionPolicy(null);

    cfg.setCopyOnRead(false);

    cfg.setCacheMode(CacheMode.REPLICATED);

    cfg.setOnheapCacheEnabled(true);

    cfg.setReadFromBackup(true);

    cfg.setName(COLUMN_DECISION_TREE_TRAINER_CONTEXT_CACHE_NAME);

    return ignite.getOrCreateCache(cfg);
}
 
开发者ID:Luodian,项目名称:Higher-Cloud-Computing-Project,代码行数:29,代码来源:ContextCache.java


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