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


Java CacheConfiguration.setCacheMode方法代码示例

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


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

示例1: apply

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @param config      the akka configuration object
 * @param actorSystem the akk actor system
 * @return the created snapshot ignite cache
 */
@Override
public IgniteCache<Long, SnapshotItem> apply(Config config, ActorSystem actorSystem) {
    final IgniteExtension extension = IgniteExtensionProvider.EXTENSION.get(actorSystem);
    final String cachePrefix = config.getString(CACHE_PREFIX_PROPERTY);
    final int cacheBackups = config.getInt(CACHE_BACKUPS);
    final CacheConfiguration<Long, SnapshotItem> eventStore = new CacheConfiguration();
    eventStore.setCopyOnRead(false);
    if (cacheBackups > 0) {
        eventStore.setBackups(cacheBackups);
    } else {
        eventStore.setBackups(1);
    }
    eventStore.setAtomicityMode(CacheAtomicityMode.ATOMIC);
    eventStore.setName(cachePrefix + "_SNAPSHOT");
    eventStore.setCacheMode(CacheMode.PARTITIONED);
    eventStore.setReadFromBackup(true);
    eventStore.setIndexedTypes(Long.class, SnapshotItem.class);
    eventStore.setIndexedTypes(String.class, SnapshotItem.class);
    return extension.getIgnite().getOrCreateCache(eventStore);
}
 
开发者ID:Romeh,项目名称:akka-persistance-ignite,代码行数:26,代码来源:SnapshotCacheProvider.java

示例2: createCache

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * Creates cache with full configuration. Active store is used.
 *
 * @param cacheName name of cache.
 * @param atomicityMode atomicity.
 * @param cacheMode mode.
 * @param writeBehindEnabled should write behind be used for active store.
 * @param flushFreq flush frequency for write behind.
 * @param base configuration to copy settings from.
 * @param <K> type of key.
 * @param <V> type of value
 * @return cache instance.
 */
@SuppressWarnings("unchecked")
public <K, V> IgniteCache<K, V> createCache(String cacheName, CacheAtomicityMode atomicityMode, CacheMode cacheMode,
    boolean writeBehindEnabled, int flushFreq,
    CacheConfiguration<K, V> base) {
    CacheConfiguration<K, V> realConfiguration = base == null
        ? new CacheConfiguration<K, V>()
        : new CacheConfiguration<K, V>(base);
    realConfiguration.setName(cacheName);
    realConfiguration.setAtomicityMode(atomicityMode);
    realConfiguration.setCacheMode(cacheMode);
    realConfiguration.setBackups(2);
    realConfiguration.setWriteThrough(true);
    realConfiguration.setReadThrough(true);
    realConfiguration.setWriteBehindEnabled(writeBehindEnabled);
    realConfiguration.setWriteBehindFlushFrequency(flushFreq);
    realConfiguration.setCacheStoreFactory(activeStoreConfiguration.activeCacheStoreFactory());
    return ignite().createCache(realConfiguration);
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:32,代码来源:TestResources.java

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

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

示例5: MemorySpatialIndexSegment

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
public MemorySpatialIndexSegment(String uniqueName, SpatialPartitioner
        partitioner, long batchUpdateTimeMilliseconds, StreamDataset
        stream, Attribute indexedAttribute)
{
    this.setName(uniqueName);
    this.spatialPartitioner = partitioner;
    this.stream = stream;
    this.indexedAttribute = indexedAttribute;

    //Index creation

    //Setting index configuration
    CacheConfiguration<Integer,SpatialPartition> cnfig = new
            CacheConfiguration<> (this.getName());
    cnfig.setCacheMode(CacheMode.LOCAL);
    cnfig.setCacheStoreFactory(new IgniteReflectionFactory<BulkLoadSpatialCacheStore>
            (BulkLoadSpatialCacheStore.class));
    cnfig.setWriteThrough(true);

    Ignite cluster = KiteInstance.getCluster(); //getting underlying cluster
    spatialPartitionsData = cluster.getOrCreateCache(cnfig); //create
}
 
开发者ID:amrmagdy4,项目名称:kite,代码行数:23,代码来源:MemorySpatialIndexSegment.java

示例6: MemoryHashIndexSegment

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
public MemoryHashIndexSegment(String uniqueName, long
        batchUpdateTimeMilliseconds) {
    this.setName(uniqueName);

    //Index creation

    //Setting index configuration
    CacheConfiguration<String,ArrayList<Long>> cnfig = new
            CacheConfiguration<String,ArrayList<Long>>(this.getName());
    cnfig.setCacheMode(CacheMode.LOCAL);
    cnfig.setCacheStoreFactory(new IgniteReflectionFactory<BulkLoadCacheStore>
            (BulkLoadCacheStore.class));
    cnfig.setWriteThrough(true);

    Ignite cluster = KiteInstance.getCluster(); //getting underlying cluster
    hashIndex = cluster.getOrCreateCache(cnfig); //create index
}
 
开发者ID:amrmagdy4,项目名称:kite,代码行数:18,代码来源:MemoryHashIndexSegment.java

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

示例8: getConfiguration

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

    CacheConfiguration cacheCfg = defaultCacheConfiguration();

    cacheCfg.setCacheMode(PARTITIONED);
    cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_ASYNC);
    cacheCfg.setRebalanceMode(NONE);
    cacheCfg.setAffinity(new RendezvousAffinityFunction(false, partitions));
    cacheCfg.setBackups(backups);
    cacheCfg.setAtomicityMode(TRANSACTIONAL);
    //cacheCfg.setRebalanceThreadPoolSize(1);

    TcpDiscoverySpi disco = new TcpDiscoverySpi();

    disco.setIpFinder(ipFinder);

    cfg.setDiscoverySpi(disco);
    cfg.setCacheConfiguration(cacheCfg);
    cfg.setDeploymentMode(CONTINUOUS);

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

示例9: getConfiguration

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

    ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);

    if (cache) {
        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);

        ccfg.setCacheMode(CacheMode.PARTITIONED);
        ccfg.setBackups(1);
        ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);

        ccfg.setNearConfiguration(null);

        ccfg.setAffinity(new RendezvousAffinityFunction(false, PARTS));

        cfg.setCacheConfiguration(ccfg);
    }
    else
        cfg.setClientMode(true);

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

示例10: cacheConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @param name Cache name.
 * @param cacheMode Cache mode.
 * @param writeSync Write synchronization mode.
 * @param nearCache Near cache flag.
 * @return Cache configuration.
 */
protected CacheConfiguration cacheConfiguration(String name,
    CacheMode cacheMode,
    CacheWriteSynchronizationMode writeSync,
    boolean nearCache) {
    CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);

    ccfg.setName(name);
    ccfg.setCacheMode(cacheMode);
    ccfg.setAtomicityMode(TRANSACTIONAL);
    ccfg.setWriteSynchronizationMode(writeSync);

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

    ccfg.setAffinity(new RendezvousAffinityFunction());

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

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

示例11: apply

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @param config      the akka configuration object
 * @param actorSystem the akk actor system
 * @return the created journal and sequence ignite caches†
 */
@Override
public JournalCaches apply(Config config, ActorSystem actorSystem) {
    final IgniteExtension extension = IgniteExtensionProvider.EXTENSION.get(actorSystem);
    final String cachePrefix = config.getString(CACHE_PREFIX_PROPERTY);
    final int cacheBackups = config.getInt(CACHE_BACKUPS);
    // cache configuration
    final CacheConfiguration<Long, JournalItem> eventStore = new CacheConfiguration();
    eventStore.setCopyOnRead(false);
    if (cacheBackups > 0) {
        eventStore.setBackups(cacheBackups);
    } else {
        eventStore.setBackups(1);
    }
    eventStore.setAtomicityMode(CacheAtomicityMode.ATOMIC);
    eventStore.setName(cachePrefix);
    eventStore.setCacheMode(CacheMode.PARTITIONED);
    eventStore.setReadFromBackup(true);
    eventStore.setIndexedTypes(Long.class, JournalItem.class);
    eventStore.setIndexedTypes(String.class, JournalItem.class);
    eventStore.setInterceptor(new JournalStoreInterceptor());

    //sequence Number Tracking
    final CacheConfiguration<String, Long> squenceNumberTrack = new CacheConfiguration();
    squenceNumberTrack.setCopyOnRead(false);
    if (cacheBackups > 0) {
        squenceNumberTrack.setBackups(cacheBackups);
    } else {
        squenceNumberTrack.setBackups(1);
    }
    squenceNumberTrack.setAtomicityMode(CacheAtomicityMode.ATOMIC);
    squenceNumberTrack.setName("sequenceNumberTrack");
    squenceNumberTrack.setCacheMode(CacheMode.PARTITIONED);
    squenceNumberTrack.setReadFromBackup(true);
    return JournalCaches.builder()
            .journalCache(extension.getIgnite().getOrCreateCache(eventStore))
            .sequenceCache(extension.getIgnite().getOrCreateCache(squenceNumberTrack))
            .build();
}
 
开发者ID:Romeh,项目名称:akka-persistance-ignite,代码行数:44,代码来源:JournalCacheProvider.java

示例12: geneCache

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * 
 * @return CacheConfiguration<Long, Gene>
 */
public static CacheConfiguration<Long, Gene> geneCache() {

    CacheConfiguration<Long, Gene> cfg = new CacheConfiguration<>(GAGridConstants.GENE_CACHE);
    cfg.setIndexedTypes(Long.class, Gene.class);
    cfg.setCacheMode(CacheMode.REPLICATED);
    cfg.setRebalanceMode(CacheRebalanceMode.SYNC);
    cfg.setStatisticsEnabled(true);
    cfg.setBackups(1);
    cfg.setSqlFunctionClasses(GAGridFunction.class);
    return cfg;

}
 
开发者ID:techbysample,项目名称:gagrid,代码行数:17,代码来源:GeneCacheConfig.java

示例13: populationCache

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * 
 * @return CacheConfiguration<Long, Chromosome>
 */
public static CacheConfiguration<Long, Chromosome> populationCache() {

    CacheConfiguration<Long, Chromosome> cfg = new CacheConfiguration<>(GAGridConstants.POPULATION_CACHE);
    cfg.setIndexedTypes(Long.class, Chromosome.class);
    cfg.setCacheMode(CacheMode.PARTITIONED);
    cfg.setRebalanceMode(CacheRebalanceMode.SYNC);
    cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
    cfg.setStatisticsEnabled(true);
    cfg.setBackups(1);

    return cfg;

}
 
开发者ID:techbysample,项目名称:gagrid,代码行数:18,代码来源:PopulationCacheConfig.java

示例14: getConfig

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
@NotNull
public static CacheConfiguration<String, Object> getConfig() {
    CacheConfiguration<String, Object> atomics = new CacheConfiguration<>();
    atomics.setName(NAME);
    atomics.setAtomicityMode(CacheAtomicityMode.ATOMIC);
    atomics.setCacheMode(CacheMode.REPLICATED);
    return atomics;
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:9,代码来源:MetadataAtomicsHelper.java

示例15: createSimpleCache

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * Creates cache with minimal configuration. Active store is not used.
 *
 * @param cacheName name of cache.
 * @param atomicityMode atomicity.
 * @param cacheMode mode.
 * @param base configuration to copy settings from.
 * @param <K> type of key.
 * @param <V> type of value
 * @return cache instance.
 */
public <K, V> IgniteCache<K, V> createSimpleCache(String cacheName, CacheAtomicityMode atomicityMode,
    CacheMode cacheMode, CacheConfiguration<K, V> base) {
    CacheConfiguration<K, V> realConfiguration = base == null
        ? new CacheConfiguration<K, V>()
        : new CacheConfiguration<K, V>(base);
    realConfiguration.setName(cacheName);
    realConfiguration.setAtomicityMode(atomicityMode);
    realConfiguration.setCacheMode(cacheMode);
    realConfiguration.setBackups(2);
    return ignite().createCache(realConfiguration);
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:23,代码来源:TestResources.java


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