Java Code Examples for org.apache.ignite.configuration.CacheConfiguration#setWriteBehindFlushFrequency()

The following examples show how to use org.apache.ignite.configuration.CacheConfiguration#setWriteBehindFlushFrequency() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IgniteCacheStoreSessionWriteBehindAbstractTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * @param igniteInstanceName Ignite instance name.
 * @return Cache configuration.
 * @throws Exception In case of error.
 */
@Override @SuppressWarnings("unchecked")
protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception {
    CacheConfiguration ccfg0 = super.cacheConfiguration(igniteInstanceName);

    ccfg0.setReadThrough(true);
    ccfg0.setWriteThrough(true);
    ccfg0.setWriteBehindBatchSize(10);
    ccfg0.setWriteBehindFlushSize(10);
    ccfg0.setWriteBehindFlushFrequency(600);
    ccfg0.setWriteBehindEnabled(true);

    ccfg0.setCacheStoreFactory(singletonFactory(new TestStore()));

    return ccfg0;
}
 
Example 2
Source File: CacheStoreUsageMultinodeAbstractTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * @return Cache configuration.
 */
@SuppressWarnings("unchecked")
protected CacheConfiguration cacheConfiguration() {
    CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);

    ccfg.setCacheMode(PARTITIONED);
    ccfg.setAtomicityMode(atomicityMode());
    ccfg.setBackups(1);
    ccfg.setWriteSynchronizationMode(FULL_SYNC);

    if (cacheStore) {
        if (writeBehind) {
            ccfg.setWriteBehindEnabled(true);
            ccfg.setWriteBehindFlushFrequency(100);
        }

        ccfg.setWriteThrough(true);

        ccfg.setCacheStoreFactory(locStore ? new TestLocalStoreFactory() : new TestStoreFactory());
    }

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

    return ccfg;
}
 
Example 3
Source File: GridCacheWriteBehindStorePartitionedMultiNodeSelfTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(igniteInstanceName);

    CacheConfiguration cc = defaultCacheConfiguration();

    cc.setCacheMode(CacheMode.PARTITIONED);
    cc.setWriteBehindEnabled(true);
    cc.setWriteBehindFlushFrequency(WRITE_BEHIND_FLUSH_FREQ);
    cc.setAtomicityMode(TRANSACTIONAL);
    cc.setNearConfiguration(new NearCacheConfiguration());

    CacheStore store = stores[idx.getAndIncrement()] = new GridCacheTestStore();

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

    c.setCacheConfiguration(cc);

    return c;
}
 
Example 4
Source File: CacheStoreSessionListenerWriteBehindEnabledTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception {
    MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);

    CacheConfiguration cacheCfg = super.cacheConfiguration(igniteInstanceName);

    cacheCfg.setCacheStoreFactory(FactoryBuilder.factoryOf(EmptyCacheStore.class));

    cacheCfg.setCacheStoreSessionListenerFactories(new CacheStoreSessionFactory());

    cacheCfg.setReadThrough(true);
    cacheCfg.setWriteThrough(true);

    cacheCfg.setWriteBehindEnabled(true);
    cacheCfg.setWriteBehindBatchSize(CNT * 2);
    cacheCfg.setWriteBehindFlushFrequency(WRITE_BEHIND_FLUSH_FREQUENCY);

    cacheCfg.setBackups(0);

    return cacheCfg;
}
 
Example 5
Source File: GridCacheWriteBehindStoreLoadTest.java    From ignite with Apache License 2.0 3 votes vote down vote up
/** {@inheritDoc} */
@SuppressWarnings({"unchecked"})
@Override protected final IgniteConfiguration getConfiguration() throws Exception {
    IgniteConfiguration c = super.getConfiguration();

    TcpDiscoverySpi disco = new TcpDiscoverySpi();

    disco.setIpFinder(new TcpDiscoveryVmIpFinder(true));

    c.setDiscoverySpi(disco);

    CacheConfiguration cc = defaultCacheConfiguration();

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

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

    cc.setWriteBehindEnabled(true);
    cc.setWriteBehindFlushFrequency(WRITE_FROM_BEHIND_FLUSH_FREQUENCY);

    c.setCacheConfiguration(cc);

    return c;
}
 
Example 6
Source File: GridCacheWriteBehindStoreAbstractTest.java    From ignite with Apache License 2.0 3 votes vote down vote up
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override protected IgniteConfiguration getConfiguration() throws Exception {
    MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);

    IgniteConfiguration c = super.getConfiguration();

    TcpDiscoverySpi disco = new TcpDiscoverySpi();

    disco.setIpFinder(new TcpDiscoveryVmIpFinder(true));

    c.setDiscoverySpi(disco);

    CacheConfiguration cc = defaultCacheConfiguration();

    cc.setCacheMode(cacheMode());
    cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    cc.setAtomicityMode(TRANSACTIONAL);

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

    cc.setWriteBehindEnabled(true);
    cc.setWriteBehindFlushFrequency(WRITE_FROM_BEHIND_FLUSH_FREQUENCY);

    c.setCacheConfiguration(cc);

    return c;
}