Search in sources :

Example 61 with CacheConfiguration

use of org.apache.ignite.configuration.CacheConfiguration in project ignite by apache.

the class GridCacheMvccFlagsTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration() throws Exception {
    IgniteConfiguration cfg = super.getConfiguration();
    CacheConfiguration cacheCfg = defaultCacheConfiguration();
    cacheCfg.setCacheMode(REPLICATED);
    cfg.setCacheConfiguration(cacheCfg);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 62 with CacheConfiguration

use of org.apache.ignite.configuration.CacheConfiguration in project ignite by apache.

the class GridCacheIteratorPerformanceTest method cacheConfiguration.

/**
     * @return Cache configuration.
     */
private CacheConfiguration cacheConfiguration() {
    CacheConfiguration cfg = defaultCacheConfiguration();
    cfg.setCacheMode(PARTITIONED);
    cfg.setBackups(1);
    return cfg;
}
Also used : CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 63 with CacheConfiguration

use of org.apache.ignite.configuration.CacheConfiguration in project ignite by apache.

the class GridCacheLeakTest method cacheConfiguration.

/**
     * Gets cache configuration.
     *
     * @return Data cache configuration.
     */
protected CacheConfiguration cacheConfiguration() {
    CacheConfiguration cfg = defaultCacheConfiguration();
    cfg.setName(CACHE_NAME);
    cfg.setAffinity(new RendezvousAffinityFunction(false, 128));
    cfg.setCacheMode(PARTITIONED);
    cfg.setBackups(1);
    cfg.setNearConfiguration(null);
    cfg.setWriteSynchronizationMode(FULL_SYNC);
    cfg.setAtomicityMode(atomicityMode);
    return cfg;
}
Also used : RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 64 with CacheConfiguration

use of org.apache.ignite.configuration.CacheConfiguration in project ignite by apache.

the class IgniteCacheReadThroughStoreCallTest method cacheConfiguration.

/**
     * @param cacheMode Cache mode.
     * @param atomicityMode Atomicity mode.
     * @param backups Number of backups.
     * @return Cache configuration.
     */
@SuppressWarnings("unchecked")
protected CacheConfiguration<Object, Object> cacheConfiguration(CacheMode cacheMode, CacheAtomicityMode atomicityMode, int backups) {
    CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
    ccfg.setReadThrough(true);
    ccfg.setWriteThrough(true);
    ccfg.setCacheStoreFactory(new TestStoreFactory());
    ccfg.setWriteSynchronizationMode(FULL_SYNC);
    ccfg.setAtomicityMode(atomicityMode);
    ccfg.setCacheMode(cacheMode);
    ccfg.setAffinity(new RendezvousAffinityFunction(false, 32));
    if (cacheMode == PARTITIONED)
        ccfg.setBackups(backups);
    return ccfg;
}
Also used : RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 65 with CacheConfiguration

use of org.apache.ignite.configuration.CacheConfiguration in project ignite by apache.

the class IgniteCacheStoreValueAbstractTest method cacheConfiguration.

/** {@inheritDoc} */
@Override
protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception {
    CacheConfiguration ccfg = super.cacheConfiguration(igniteInstanceName);
    if (ccfg.getCacheMode() != CacheMode.LOCAL)
        assertEquals(1, ccfg.getBackups());
    assertTrue(ccfg.isCopyOnRead());
    ccfg.setCopyOnRead(cpyOnRead);
    assertEquals(FULL_SYNC, ccfg.getWriteSynchronizationMode());
    ccfg.setCacheStoreFactory(singletonFactory(new CacheStoreAdapter() {

        @Override
        public void loadCache(IgniteBiInClosure clo, Object... args) {
            clo.apply(new TestKey(100_000), new TestValue(30_000));
        }

        @Override
        public Object load(Object key) throws CacheLoaderException {
            return null;
        }

        @Override
        public void write(Cache.Entry entry) throws CacheWriterException {
        // No-op.
        }

        @Override
        public void delete(Object key) throws CacheWriterException {
        // No-op.
        }
    }));
    ccfg.setInterceptor(new TestInterceptor());
    return ccfg;
}
Also used : MutableEntry(javax.cache.processor.MutableEntry) CacheStoreAdapter(org.apache.ignite.cache.store.CacheStoreAdapter) IgniteBiInClosure(org.apache.ignite.lang.IgniteBiInClosure) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Aggregations

CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)980 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)392 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)287 NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)250 Ignite (org.apache.ignite.Ignite)148 ArrayList (java.util.ArrayList)69 RendezvousAffinityFunction (org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction)64 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)59 QueryEntity (org.apache.ignite.cache.QueryEntity)44 IgniteException (org.apache.ignite.IgniteException)43 CacheException (javax.cache.CacheException)42 IgfsGroupDataBlocksKeyMapper (org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper)40 IgniteEx (org.apache.ignite.internal.IgniteEx)40 IgniteCache (org.apache.ignite.IgniteCache)39 LinkedHashMap (java.util.LinkedHashMap)35 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)34 TcpDiscoveryVmIpFinder (org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder)32 FileSystemConfiguration (org.apache.ignite.configuration.FileSystemConfiguration)30 TcpCommunicationSpi (org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi)30 Transaction (org.apache.ignite.transactions.Transaction)28