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


Java CacheConfiguration.setWriteThrough方法代码示例

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


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

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

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

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

示例4: cacheConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @return Cache configuration for test.
 * @throws Exception In case when failed to create cache configuration.
 */
protected CacheConfiguration cacheConfiguration() throws Exception {
    CacheConfiguration cc = defaultCacheConfiguration();

    cc.setName(CACHE_NAME);
    cc.setCacheMode(PARTITIONED);
    cc.setAtomicityMode(transactional ? TRANSACTIONAL : ATOMIC);
    cc.setWriteBehindEnabled(false);
    cc.setStoreKeepBinary(storeKeepBinary());

    CacheJdbcPojoStoreFactory<Object, Object> storeFactory = new CacheJdbcPojoStoreFactory<>();
    storeFactory.setDialect(new H2Dialect());
    storeFactory.setTypes(storeTypes());
    storeFactory.setDataSourceFactory(new H2DataSourceFactory()); // H2 DataSource factory.
    storeFactory.setSqlEscapeAll(sqlEscapeAll());
    storeFactory.setParallelLoadCacheMinimumThreshold(parallelLoadThreshold);

    cc.setCacheStoreFactory(storeFactory);
    cc.setReadThrough(true);
    cc.setWriteThrough(true);
    cc.setLoadPreviousValue(true);

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

示例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;
}
 
开发者ID:apache,项目名称:ignite,代码行数:26,代码来源:IgniteCacheWriteBehindNoUpdateSelfTest.java

示例6: getConfiguration

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

    TcpDiscoverySpi disco = new TcpDiscoverySpi();

    disco.setIpFinder(new TcpDiscoveryVmIpFinder(true));

    cfg.setDiscoverySpi(disco);

    CacheConfiguration ccfg = defaultCacheConfiguration();

    ccfg.setName("test-cache");
    ccfg.setCacheMode(LOCAL);
    ccfg.setCacheStoreFactory(singletonFactory(new TestStore()));
    ccfg.setReadThrough(true);
    ccfg.setWriteThrough(true);
    ccfg.setLoadPreviousValue(true);

    cfg.setCacheConfiguration(ccfg);

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

示例7: cacheConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @param backups Number of backups.
 * @param store Cache store flag.
 * @param writeThrough Store write through flag.
 * @return Cache configuration.
 */
private CacheConfiguration<Integer, Integer> cacheConfiguration(int backups, boolean store, boolean writeThrough) {
    CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);

    ccfg.setAtomicityMode(TRANSACTIONAL);
    ccfg.setWriteSynchronizationMode(FULL_SYNC);
    ccfg.setBackups(backups);
    ccfg.setRebalanceMode(ASYNC);

    if (store) {
        ccfg.setWriteThrough(writeThrough);

        ccfg.setCacheStoreFactory(new TestStoreFactory());
    }

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

示例8: cacheConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @return Cache configuration.
 */
@SuppressWarnings("unchecked")
protected CacheConfiguration cacheConfiguration() {
    CacheConfiguration cc = defaultCacheConfiguration();

    // Template
    cc.setName("*");

    cc.setRebalanceMode(SYNC);

    cc.setCacheStoreFactory(singletonFactory(store));
    cc.setReadThrough(true);
    cc.setWriteThrough(true);
    cc.setLoadPreviousValue(true);
    cc.setStoreKeepBinary(true);

    cc.setCacheMode(cacheMode());
    cc.setWriteSynchronizationMode(cacheWriteSynchronizationMode());

    cc.setBackups(0);

    cc.setAtomicityMode(CacheAtomicityMode.ATOMIC);

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

示例9: cacheConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 *
 * @param cacheMode Cache mode.
 * @param backups Number of backups.
 * @param atomicityMode Cache atomicity mode.
 * @param store If {@code true} configures dummy cache store.
 * @return Cache configuration.
 */
protected CacheConfiguration<Object, Object> cacheConfiguration(
    CacheMode cacheMode,
    int backups,
    CacheAtomicityMode atomicityMode,
    boolean store) {
    CacheConfiguration<TestKey, TestValue> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);

    ccfg.setAtomicityMode(atomicityMode);
    ccfg.setCacheMode(cacheMode);
    ccfg.setWriteSynchronizationMode(FULL_SYNC);

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

    if (store) {
        ccfg.setCacheStoreFactory(new TestStoreFactory());
        ccfg.setReadThrough(true);
        ccfg.setWriteThrough(true);
    }

    ccfg.setInterceptor(new TestInterceptor());

    return (CacheConfiguration)ccfg;
}
 
开发者ID:apache,项目名称:ignite,代码行数:33,代码来源:CacheInterceptorPartitionCounterRandomOperationsTest.java

示例10: cacheConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 *
 * @param cacheMode Cache mode.
 * @param backups Number of backups.
 * @param atomicityMode Cache atomicity mode.
 * @param store If {@code true} configures dummy cache store.
 * @return Cache configuration.
 */
protected CacheConfiguration<Object, Object> cacheConfiguration(
    CacheMode cacheMode,
    int backups,
    CacheAtomicityMode atomicityMode,
    boolean store) {
    CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);

    ccfg.setName("cache-" + UUID.randomUUID()); // TODO GG-11220 (remove setName when fixed).
    ccfg.setAtomicityMode(atomicityMode);
    ccfg.setCacheMode(cacheMode);
    ccfg.setWriteSynchronizationMode(FULL_SYNC);

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

    if (store) {
        ccfg.setCacheStoreFactory(new TestStoreFactory());
        ccfg.setReadThrough(true);
        ccfg.setWriteThrough(true);
    }

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

示例11: prepareConfig

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private static <K, V> IgniteConfiguration prepareConfig(HBaseCacheStoreSessionListener cssl,
    HBaseCacheStore<K, V> cs, boolean writeBehind) {
  IgniteConfiguration cfg = new IgniteConfiguration();
  CacheConfiguration<K, V> cacheCfg = new CacheConfiguration<>();
  cacheCfg.setWriteThrough(true);
  cacheCfg.setWriteBehindEnabled(writeBehind);
  cacheCfg.setReadThrough(true);
  cacheCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
  cacheCfg.setCacheStoreFactory(FactoryBuilder.factoryOf(cs));
  cacheCfg.setCacheStoreSessionListenerFactories(FactoryBuilder.factoryOf(cssl));
  cfg.setCacheConfiguration(cacheCfg);
  return cfg;
}
 
开发者ID:bakdata,项目名称:ignite-hbase,代码行数:15,代码来源:HBaseCacheStoreTest.java

示例12: buildCacheConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** */
private CacheConfiguration buildCacheConfiguration(CacheMode mode,
    CacheAtomicityMode atomicityMode, boolean hasNear, boolean writeThrough, boolean notNullAnnotated) {

    CacheConfiguration cfg = new CacheConfiguration(CACHE_PREFIX + "-" +
        mode.name() + "-" + atomicityMode.name() + (hasNear ? "-near" : "") +
        (writeThrough ? "-writethrough" : "") + (notNullAnnotated ? "-annot" : ""));

    cfg.setCacheMode(mode);
    cfg.setAtomicityMode(atomicityMode);
    cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);

    QueryEntity qe = new QueryEntity(new QueryEntity(Integer.class, Person.class));

    if (!notNullAnnotated)
        qe.setNotNullFields(Collections.singleton("name"));

    cfg.setQueryEntities(F.asList(qe));

    if (hasNear)
        cfg.setNearConfiguration(new NearCacheConfiguration().setNearStartSize(100));

    if (writeThrough) {
        cfg.setCacheStoreFactory(singletonFactory(new TestStore()));
        cfg.setWriteThrough(true);
    }

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

示例13: getConfiguration

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

    TcpDiscoverySpi spi = new TcpDiscoverySpi();

    spi.setIpFinder(ipFinder);

    cfg.setDiscoverySpi(spi);

    CacheConfiguration cacheCfg = defaultCacheConfiguration();

    cacheCfg.setCacheMode(PARTITIONED);
    cacheCfg.setNearConfiguration(null);
    cacheCfg.setAffinity(new RendezvousAffinityFunction(false, 30));
    cacheCfg.setBackups(1);
    cacheCfg.setWriteSynchronizationMode(FULL_SYNC);

    if (storeEnabled) {
        cacheCfg.setCacheStoreFactory(singletonFactory(new GridCacheTestStore()));
        cacheCfg.setReadThrough(true);
        cacheCfg.setWriteThrough(true);
        cacheCfg.setLoadPreviousValue(true);
    }
    else
        cacheCfg.setCacheStoreFactory(null);

    cfg.setCacheConfiguration(cacheCfg);

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

示例14: checkConnectionLeak

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @param atomicityMode Atomicity mode.
 * @param txConcurrency Transaction concurrency.
 * @param txIsolation Transaction isolation.
 *
 * @throws Exception If failed.
 */
private void checkConnectionLeak(
        CacheAtomicityMode atomicityMode,
        TransactionConcurrency txConcurrency,
        TransactionIsolation txIsolation
) throws Exception {
    CacheConfiguration<Integer, Integer> cacheCfg = new CacheConfiguration<>();

    cacheCfg.setName(CACHE_NAME);
    cacheCfg.setCacheMode(CacheMode.PARTITIONED);
    cacheCfg.setAtomicityMode(atomicityMode);
    cacheCfg.setCacheStoreFactory(new TestStoreFactory());
    cacheCfg.setReadThrough(true);
    cacheCfg.setWriteThrough(false);
    cacheCfg.setLoadPreviousValue(true);

    Ignite ignite = ignite(CLIENT_NODE);
    IgniteCache<Integer, Integer> cache = ignite.createCache(cacheCfg);

    try {
        assertEquals(0, cache.size());

        if (atomicityMode == CacheAtomicityMode.TRANSACTIONAL) {
            try (Transaction tx = ignite.transactions().txStart(txConcurrency, txIsolation)) {
                cacheOp(cache);

                tx.commit();
            }
        }
        else {
            cacheOp(cache);
        }

        assertTrue("Session was leak on nodes: " + TestStore.sessions, TestStore.sessions.isEmpty());
    }
    finally {
        cache.destroy();
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:46,代码来源:CacheConnectionLeakStoreTxTest.java

示例15: cacheConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @param cacheMode Cache mode.
 * @param syncMode Write synchronization mode.
 * @param backups Number of backups.
 * @param storeEnabled If {@code true} adds cache store.
 * @param nearCache If {@code true} near cache is enabled.
 * @return Cache configuration.
 */
private CacheConfiguration<Integer, Integer> cacheConfiguration(
    CacheMode cacheMode,
    CacheWriteSynchronizationMode syncMode,
    int backups,
    boolean storeEnabled,
    boolean nearCache) {
    CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);

    ccfg.setCacheMode(cacheMode);
    ccfg.setAtomicityMode(TRANSACTIONAL);
    ccfg.setWriteSynchronizationMode(syncMode);

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

    if (storeEnabled) {
        ccfg.setCacheStoreFactory(new TestStoreFactory());
        ccfg.setWriteThrough(true);
        ccfg.setReadThrough(true);
    }

    if (nearCache)
        ccfg.setNearConfiguration(new NearCacheConfiguration<Integer, Integer>());

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


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