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


Java CacheConfiguration.setOnheapCacheEnabled方法代码示例

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


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

示例1: 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(ipFinder);
    cfg.setDiscoverySpi(discoSpi);

    CacheConfiguration cacheCfg = defaultCacheConfiguration();

    cacheCfg.setCacheMode(cacheMode);
    cacheCfg.setEvictionPolicy(evictionPlc);
    cacheCfg.setOnheapCacheEnabled(true);
    cacheCfg.setNearConfiguration(nearEnabled ? new NearCacheConfiguration() : null);
    cacheCfg.setAtomicityMode(TRANSACTIONAL);

    cfg.setCacheConfiguration(cacheCfg);

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

示例2: 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

示例3: getConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@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);
}
 
开发者ID:apache,项目名称:ignite,代码行数:27,代码来源:ClusterNodeMetricsSelfTest.java

示例4: cacheConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @return Cache configuration.
 */
private CacheConfiguration<String, TestClass> cacheConfiguration(
    CacheMode mode,
    CacheAtomicityMode atomMode,
    boolean nearEnabled,
    boolean useEvictPlc
) {
    final CacheConfiguration<String, TestClass> ccfg = new CacheConfiguration<>(CACHE_NAME);

    ccfg.setAtomicityMode(atomMode);
    ccfg.setCacheMode(mode);
    ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);

    if (nearEnabled)
        ccfg.setNearConfiguration(new NearCacheConfiguration<String, TestClass>());

    if (useEvictPlc) {
        ccfg.setEvictionPolicy(new FifoEvictionPolicy(50));
        ccfg.setOnheapCacheEnabled(true);
    }

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

示例5: getConfiguration

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

    CacheConfiguration cc = defaultCacheConfiguration();

    cc.setCacheMode(mode);
    cc.setEvictionPolicy(notSerializableProxy(plc, EvictionPolicy.class));
    cc.setOnheapCacheEnabled(true);
    cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    cc.setEvictionFilter(notSerializableProxy(filter, org.apache.ignite.cache.eviction.EvictionFilter.class));
    cc.setRebalanceMode(SYNC);
    cc.setAtomicityMode(TRANSACTIONAL);

    if (nearEnabled) {
        NearCacheConfiguration nearCfg = new NearCacheConfiguration();
        nearCfg.setNearEvictionPolicy(notSerializableProxy(plc, EvictionPolicy.class));

        cc.setNearConfiguration(nearCfg);
    }
    else
        cc.setNearConfiguration(null);

    if (mode == PARTITIONED)
        cc.setBackups(1);

    c.setCacheConfiguration(cc);

    TcpDiscoverySpi disco = new TcpDiscoverySpi();

    disco.setIpFinder(ipFinder);

    c.setDiscoverySpi(disco);

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

示例6: getConfiguration

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

    TcpDiscoverySpi disco = new TcpDiscoverySpi();

    disco.setIpFinder(ipFinder);

    c.setDiscoverySpi(disco);

    CacheConfiguration<?,?> cc = defaultCacheConfiguration();

    cc.setCacheMode(PARTITIONED);
    cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    cc.setRebalanceMode(SYNC);
    cc.setNearConfiguration(new NearCacheConfiguration());

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

    cc.setEvictionPolicy(plc);
    cc.setOnheapCacheEnabled(true);
    cc.setBackups(1);
    cc.setAtomicityMode(TRANSACTIONAL);
    cc.setIndexedTypes(
        Integer.class, ObjectValue.class
    );

    c.setCacheConfiguration(cc);

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

示例7: cacheConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @param igniteInstanceName Ignite instance name.
 * @return Cache configuration.
 * @throws Exception In case of error.
 */
@SuppressWarnings("unchecked")
protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception {
    CacheConfiguration cfg = defaultCacheConfiguration();

    cfg.setCacheMode(cacheMode());
    cfg.setAtomicityMode(atomicityMode());

    cfg.setWriteSynchronizationMode(writeSynchronization());
    cfg.setNearConfiguration(nearConfiguration());

    cfg.setCacheLoaderFactory(loaderFactory());

    if (cfg.getCacheLoaderFactory() != null)
        cfg.setReadThrough(true);

    cfg.setCacheWriterFactory(writerFactory());

    if (cfg.getCacheWriterFactory() != null)
        cfg.setWriteThrough(true);

    Factory<CacheStore> storeFactory = cacheStoreFactory();

    if (storeFactory != null) {
        cfg.setCacheStoreFactory(storeFactory);
        cfg.setReadThrough(true);
        cfg.setWriteThrough(true);
        cfg.setLoadPreviousValue(true);

        cfg.setWriteBehindEnabled(writeBehindEnabled());
        cfg.setWriteBehindCoalescing(writeBehindCoalescing());
    }

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

    cfg.setOnheapCacheEnabled(onheapCacheEnabled());

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

示例8: cacheConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @param igniteInstanceName Ignite instance name.
 * @return Cache configuration.
 * @throws Exception In case of error.
 */
@SuppressWarnings("unchecked")
protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception {
    CacheConfiguration cfg = defaultCacheConfiguration();

    if (storeStgy != null) {
        Factory<? extends CacheStore<Object, Object>> storeFactory = storeStgy.getStoreFactory();

        CacheStore<?, ?> store = storeFactory.create();

        if (store != null) {
            cfg.setCacheStoreFactory(storeFactory);
            cfg.setReadThrough(true);
            cfg.setWriteThrough(true);
            cfg.setLoadPreviousValue(true);
            storeStgy.updateCacheConfiguration(cfg);
        }
    }

    cfg.setCacheMode(cacheMode());
    cfg.setAtomicityMode(atomicityMode());
    cfg.setWriteSynchronizationMode(writeSynchronization());
    cfg.setNearConfiguration(nearConfiguration());
    cfg.setOnheapCacheEnabled(onheapCacheEnabled());

    Class<?>[] idxTypes = indexedTypes();

    if (!F.isEmpty(idxTypes))
        cfg.setIndexedTypes(idxTypes);

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

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

示例9: cacheConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * Gets cache configuration for grid with given name.
 *
 * @param igniteInstanceName Ignite instance name.
 * @return Cache configuration.
 */
protected CacheConfiguration cacheConfiguration(String igniteInstanceName) {
    CacheConfiguration cacheCfg = defaultCacheConfiguration();

    cacheCfg.setCacheMode(PARTITIONED);
    cacheCfg.setRebalanceBatchSize(preloadBatchSize);
    cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
    cacheCfg.setRebalanceMode(preloadMode);
    cacheCfg.setAffinity(new RendezvousAffinityFunction(false, partitions));
    cacheCfg.setBackups(backups);
    cacheCfg.setOnheapCacheEnabled(onheapCacheEnabled());

    return cacheCfg;
}
 
开发者ID:apache,项目名称:ignite,代码行数:20,代码来源:GridCacheDhtPreloadSelfTest.java

示例10: 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

示例11: createNew

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * Create new labeled vectors cache.
 *
 * @param ignite Ignite instance.
 * @return new labeled vectors cache.
 */
public static IgniteCache<Integer, LabeledVector<Vector, Vector>> createNew(Ignite ignite) {
    CacheConfiguration<Integer, LabeledVector<Vector, Vector>> cfg = new CacheConfiguration<>();

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

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

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

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

    cfg.setBackups(0);

    cfg.setOnheapCacheEnabled(true);

    cfg.setName("LBLD_VECS_" + UUID.randomUUID().toString());

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

示例12: getOrCreate

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * Get or create region projections cache.
 *
 * @param ignite Ignite instance.
 * @return Region projections cache.
 */
public static IgniteCache<UUID, MLPGroupUpdateTrainingData> getOrCreate(Ignite ignite) {
    CacheConfiguration<UUID, MLPGroupUpdateTrainingData> cfg = new CacheConfiguration<>();

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

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

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

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

    cfg.setBackups(0);

    cfg.setOnheapCacheEnabled(true);

    cfg.setName(CACHE_NAME);

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

示例13: getOrCreate

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * Get or create region projections cache.
 *
 * @param ignite Ignite instance.
 * @return Region projections cache.
 */
public static IgniteCache<GroupTrainerCacheKey<Void>, MLPGroupTrainingCacheValue> getOrCreate(Ignite ignite) {
    CacheConfiguration<GroupTrainerCacheKey<Void>, MLPGroupTrainingCacheValue> cfg = new CacheConfiguration<>();

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

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

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

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

    cfg.setBackups(0);

    cfg.setOnheapCacheEnabled(true);

    cfg.setName(CACHE_NAME);

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

示例14: getConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@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;
}
 
开发者ID:apache,项目名称:ignite,代码行数:23,代码来源:SortedEvictionPolicyPerformanceTest.java

示例15: getOrCreate

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * Get or create region projections cache.
 *
 * @param ignite Ignite instance.
 * @return Region projections cache.
 */
public static IgniteCache<UUID, MLPGroupUpdateTrainingData> getOrCreate(Ignite ignite) {
    CacheConfiguration<UUID, MLPGroupUpdateTrainingData> cfg = new CacheConfiguration<>();

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

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

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

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

    cfg.setBackups(0);

    cfg.setOnheapCacheEnabled(true);

    cfg.setName(CACHE_NAME);

    return ignite.getOrCreateCache(cfg);
}
 
开发者ID:apache,项目名称:ignite,代码行数:30,代码来源:MLPGroupUpdateTrainerDataCache.java


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