本文整理汇总了Java中org.apache.ignite.configuration.CacheConfiguration.setCopyOnRead方法的典型用法代码示例。如果您正苦于以下问题:Java CacheConfiguration.setCopyOnRead方法的具体用法?Java CacheConfiguration.setCopyOnRead怎么用?Java CacheConfiguration.setCopyOnRead使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.configuration.CacheConfiguration
的用法示例。
在下文中一共展示了CacheConfiguration.setCopyOnRead方法的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);
}
示例2: 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);
}
示例3: 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);
}
示例4: 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);
}
示例5: getConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
CacheConfiguration<String, Long> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
ccfg.setCacheMode(CacheMode.PARTITIONED);
ccfg.setBackups(1);
ccfg.setReadFromBackup(true);
ccfg.setCopyOnRead(false);
ccfg.setName(THROTTLES_CACHE_NAME);
Duration expiryDuration = new Duration(TimeUnit.MINUTES, 1);
ccfg.setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(expiryDuration));
ccfg.setReadThrough(false);
ccfg.setWriteThrough(true);
ccfg.setCacheStoreFactory(new FactoryBuilder.SingletonFactory<>(new TestCacheStore()));
cfg.setCacheConfiguration(ccfg);
return cfg;
}
示例6: utilitySystemCache
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
* Creates utility system cache configuration.
*
* @return Utility system cache configuration.
*/
private static CacheConfiguration utilitySystemCache() {
CacheConfiguration cache = new CacheConfiguration();
cache.setName(CU.UTILITY_CACHE_NAME);
cache.setCacheMode(REPLICATED);
cache.setAtomicityMode(TRANSACTIONAL);
cache.setRebalanceMode(SYNC);
cache.setWriteSynchronizationMode(FULL_SYNC);
cache.setAffinity(new RendezvousAffinityFunction(false, 100));
cache.setNodeFilter(CacheConfiguration.ALL_NODES);
cache.setRebalanceOrder(-2); //Prior to user caches.
cache.setCopyOnRead(false);
return cache;
}
示例7: 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();
}
示例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);
}
示例9: 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);
}
示例10: 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);
}
示例11: 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);
}
示例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<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);
}
示例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<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);
}
示例14: createBiIndexedCache
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
* Creates cache where data for training is stored.
*
* @param ignite Ignite instance.
* @return cache where data for training is stored.
*/
private static IgniteCache<BiIndex, Double> createBiIndexedCache(Ignite ignite) {
CacheConfiguration<BiIndex, 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);
cfg.setBackups(0);
cfg.setName("TMP_BI_INDEXED_CACHE");
return ignite.getOrCreateCache(cfg);
}
示例15: createBiIndexedCache
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
* Create bi-indexed cache for tests.
*
* @return Bi-indexed cache.
*/
private IgniteCache<BiIndex, Double> createBiIndexedCache() {
CacheConfiguration<BiIndex, 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);
cfg.setBackups(0);
cfg.setName("TMP_BI_INDEXED_CACHE");
return Ignition.localIgnite().getOrCreateCache(cfg);
}