Java Code Examples for org.apache.ignite.configuration.CacheConfiguration#setCacheStoreFactory()
The following examples show how to use
org.apache.ignite.configuration.CacheConfiguration#setCacheStoreFactory() .
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: GridCacheNearPartitionedClearSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setLocalHost("127.0.0.1"); CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME); ccfg.setName(CACHE_NAME); ccfg.setCacheMode(PARTITIONED); ccfg.setAtomicityMode(TRANSACTIONAL); ccfg.setNearConfiguration(new NearCacheConfiguration()); ccfg.setRebalanceMode(SYNC); ccfg.setWriteSynchronizationMode(FULL_SYNC); ccfg.setBackups(BACKUP_CNT); ccfg.setCacheStoreFactory(singletonFactory(store)); ccfg.setReadThrough(true); ccfg.setWriteThrough(true); ccfg.setLoadPreviousValue(true); cfg.setCacheConfiguration(ccfg); return cfg; }
Example 2
Source File: GridCacheColocatedDebugTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); 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; }
Example 3
Source File: CacheStoreReadFromBackupTest.java From ignite with Apache License 2.0 | 6 votes |
/** */ @SuppressWarnings("unchecked") private CacheConfiguration cacheConfig(String cacheName) { CacheConfiguration ccfg = new CacheConfiguration<>(cacheName); ccfg.setCacheMode(cacheMode); ccfg.setBackups(backups); ccfg.setAtomicityMode(atomicityMode()); ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); ccfg.setAffinity(new RendezvousAffinityFunction(false, 1)); ccfg.setReadThrough(true); ccfg.setReadFromBackup(true); ccfg.setCacheStoreFactory(FactoryBuilder.factoryOf(TestStore.class)); if (near) ccfg.setNearConfiguration(new NearCacheConfiguration()); return ccfg; }
Example 4
Source File: GridCacheLocalLoadAllSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE); 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; }
Example 5
Source File: GridCacheInterceptorAbstractSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception { MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.INTERCEPTOR); if (nearEnabled()) MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); if (storeEnabled()) MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); CacheConfiguration ccfg = super.cacheConfiguration(igniteInstanceName); assertNotNull(interceptor); ccfg.setInterceptor(interceptor); if (!storeEnabled()) { ccfg.setCacheStoreFactory(null); ccfg.setReadThrough(false); ccfg.setWriteThrough(false); } return ccfg; }
Example 6
Source File: GridCacheReplicatedPreloadLifecycleSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration c = super.getConfiguration(igniteInstanceName); c.getTransactionConfiguration().setDefaultTxConcurrency(OPTIMISTIC); c.getTransactionConfiguration().setDefaultTxIsolation(READ_COMMITTED); CacheConfiguration cc1 = defaultCacheConfiguration(); cc1.setName("one"); cc1.setCacheMode(REPLICATED); cc1.setWriteSynchronizationMode(FULL_SYNC); cc1.setRebalanceMode(preloadMode); cc1.setEvictionPolicy(null); cc1.setCacheStoreFactory(null); // Identical configuration. CacheConfiguration cc2 = new CacheConfiguration(cc1); cc2.setName("two"); c.setCacheConfiguration(cc1, cc2); return c; }
Example 7
Source File: GridCacheAbstractTransformWriteThroughSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); GridCacheGenericTestStore<String, Integer> store = new GridCacheGenericTestStore<>(); stores.add(store); CacheConfiguration cacheCfg = defaultCacheConfiguration(); cacheCfg.setCacheMode(PARTITIONED); cacheCfg.setBackups(1); cacheCfg.setCacheStoreFactory(singletonFactory(store)); cacheCfg.setReadThrough(true); cacheCfg.setWriteThrough(true); cacheCfg.setLoadPreviousValue(true); cacheCfg.setAtomicityMode(TRANSACTIONAL); cacheCfg.setNearConfiguration(new NearCacheConfiguration()); cfg.setCacheConfiguration(cacheCfg); return cfg; }
Example 8
Source File: CacheContinuousQueryCounterAbstractTest.java From ignite with Apache License 2.0 | 6 votes |
/** * @return Cache configuration. */ @NotNull private CacheConfiguration cacheConfiguration() { CacheConfiguration cacheCfg = defaultCacheConfiguration(); cacheCfg.setName(CACHE_NAME); cacheCfg.setCacheMode(cacheMode()); cacheCfg.setAtomicityMode(atomicityMode()); cacheCfg.setNearConfiguration(nearConfiguration()); cacheCfg.setRebalanceMode(ASYNC); cacheCfg.setWriteSynchronizationMode(FULL_SYNC); cacheCfg.setCacheStoreFactory(new StoreFactory()); cacheCfg.setReadThrough(true); cacheCfg.setWriteThrough(true); cacheCfg.setLoadPreviousValue(true); return cacheCfg; }
Example 9
Source File: GridCacheAbstractLocalStoreSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** * @param igniteInstanceName Ignite instance name. * @param cacheName Cache name. * @param backups Number of backups. * @return Configuration. */ @SuppressWarnings("unchecked") private CacheConfiguration cache(String igniteInstanceName, String cacheName, int backups) { CacheConfiguration cacheCfg = new CacheConfiguration(); cacheCfg.setName(cacheName); cacheCfg.setCacheMode(getCacheMode()); cacheCfg.setAtomicityMode(getAtomicMode()); cacheCfg.setNearConfiguration(nearConfiguration()); cacheCfg.setWriteSynchronizationMode(FULL_SYNC); cacheCfg.setRebalanceMode(SYNC); cacheCfg.setCacheStoreFactory(new StoreFactory()); cacheCfg.setWriteThrough(true); cacheCfg.setReadThrough(true); cacheCfg.setBackups(backups); return cacheCfg; }
Example 10
Source File: GridCacheClientModesAbstractSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception { if (nearEnabled()) MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); CacheConfiguration cfg = super.cacheConfiguration(igniteInstanceName); cfg.setCacheStoreFactory(null); cfg.setReadThrough(false); cfg.setWriteThrough(false); cfg.setBackups(1); if (cfg.getCacheMode() == REPLICATED) cfg.setAffinity(null); else cfg.setAffinity(new RendezvousAffinityFunction(false, 32)); return cfg; }
Example 11
Source File: GridCacheContinuousQueryAbstractSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setPeerClassLoadingEnabled(peerClassLoadingEnabled()); if (!igniteInstanceName.equals(NO_CACHE_IGNITE_INSTANCE_NAME)) { CacheConfiguration cacheCfg = defaultCacheConfiguration(); cacheCfg.setCacheMode(cacheMode()); cacheCfg.setAtomicityMode(atomicityMode()); cacheCfg.setLoadPreviousValue(true); cacheCfg.setRebalanceMode(ASYNC); cacheCfg.setWriteSynchronizationMode(FULL_SYNC); cacheCfg.setNearConfiguration(nearConfiguration()); if (atomicityMode() != TRANSACTIONAL_SNAPSHOT) { cacheCfg.setCacheStoreFactory(new StoreFactory()); // TODO IGNITE-8582 enable for tx snapshot. cacheCfg.setReadThrough(true); // TODO IGNITE-8582 enable for tx snapshot. cacheCfg.setWriteThrough(true); // TODO IGNITE-8582 enable for tx snapshot. } else cacheCfg.setIndexedTypes(Integer.class, Integer.class); cfg.setCacheConfiguration(cacheCfg); } cfg.setIncludeEventTypes(EVTS_ALL); ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1); return cfg; }
Example 12
Source File: CacheNearReaderUpdateTest.java From ignite with Apache License 2.0 | 5 votes |
/** * @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) { if (storeEnabled) MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); 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; }
Example 13
Source File: IgniteCacheExpiryStoreLoadSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception { CacheConfiguration cfg = super.cacheConfiguration(igniteInstanceName); cfg.setCacheStoreFactory(singletonFactory(new TestStore())); cfg.setReadThrough(true); cfg.setWriteThrough(true); cfg.setLoadPreviousValue(true); return cfg; }
Example 14
Source File: GridCachePartitionedBasicStoreMultiNodeSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected final IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); if (nearCacheConfiguration() != null) MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); IgniteConfiguration c = super.getConfiguration(igniteInstanceName); CacheConfiguration cc = defaultCacheConfiguration(); cc.setCacheMode(PARTITIONED); cc.setWriteSynchronizationMode(FULL_SYNC); cc.setAtomicityMode(TRANSACTIONAL); cc.setBackups(1); cc.setCacheStoreFactory(new StoreFactory()); cc.setReadThrough(true); cc.setWriteThrough(true); cc.setLoadPreviousValue(true); cc.setNearConfiguration(nearCacheConfiguration()); c.setCacheConfiguration(cc); return c; }
Example 15
Source File: GridPartitionedBackupLoadSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** * @return Cache configuration. */ @SuppressWarnings("unchecked") private CacheConfiguration cacheConfiguration() { CacheConfiguration cfg = defaultCacheConfiguration(); cfg.setCacheMode(PARTITIONED); cfg.setBackups(1); cfg.setCacheStoreFactory(singletonFactory(store)); cfg.setReadThrough(true); cfg.setWriteThrough(true); cfg.setLoadPreviousValue(true); cfg.setWriteSynchronizationMode(FULL_SYNC); return cfg; }
Example 16
Source File: GridCacheMultinodeUpdateAbstractSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception { CacheConfiguration ccfg = super.cacheConfiguration(igniteInstanceName); ccfg.setCacheStoreFactory(null); ccfg.setReadThrough(false); ccfg.setWriteThrough(false); return ccfg; }
Example 17
Source File: DataStreamProcessorSelfTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @SuppressWarnings({"unchecked"}) @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setPeerClassLoadingEnabled(false); cfg.setIncludeProperties(); if (useCache) { CacheConfiguration cc = defaultCacheConfiguration(); cc.setCacheMode(mode); cc.setAtomicityMode(getCacheAtomicityMode()); if (nearEnabled) { NearCacheConfiguration nearCfg = new NearCacheConfiguration(); cc.setNearConfiguration(nearCfg); } cc.setWriteSynchronizationMode(FULL_SYNC); if (store != null) { cc.setCacheStoreFactory(new IgniteReflectionFactory<CacheStore>(TestStore.class)); cc.setReadThrough(true); cc.setWriteThrough(true); } cfg.setCacheConfiguration(cc); if (persistenceEnabled()) cfg.setDataStorageConfiguration(new DataStorageConfiguration() .setDefaultDataRegionConfiguration(new DataRegionConfiguration() .setPersistenceEnabled(true)) .setWalMode(WALMode.LOG_ONLY)); } else { cfg.setCacheConfiguration(); cfg.setClientMode(true); } cfg.setIncludeEventTypes(EventType.EVTS_ALL); return cfg; }
Example 18
Source File: JavaEmbeddedIgniteRDDWithLocalStoreSelfTest.java From ignite with Apache License 2.0 | 4 votes |
/** * Creates cache configuration. * * @return Cache configuration. */ private static CacheConfiguration<Object, Object> cacheConfiguration() { CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME); ccfg.setBackups(1); ccfg.setName(PARTITIONED_CACHE_NAME); ccfg.setIndexedTypes(String.class, Entity.class); ccfg.setCacheStoreFactory(FactoryBuilder.factoryOf(TestStore.class)); ccfg.setReadThrough(true); ccfg.setWriteThrough(true); return ccfg; }
Example 19
Source File: CacheHibernateStoreFactorySelfTest.java From ignite with Apache License 2.0 | 3 votes |
/** * @return Cache configuration with store. */ private CacheConfiguration<Integer, String> cacheConfiguration() { CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME); CacheHibernateBlobStoreFactory<Integer, String> factory = new CacheHibernateBlobStoreFactory(); factory.setHibernateConfigurationPath("/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml"); cfg.setCacheStoreFactory(factory); return cfg; }
Example 20
Source File: CacheJdbcBlobStoreFactorySelfTest.java From ignite with Apache License 2.0 | 3 votes |
/** * @return Cache configuration with store. */ private CacheConfiguration<Integer, String> cacheConfiguration() { CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME); CacheJdbcBlobStoreFactory<Integer, String> factory = new CacheJdbcBlobStoreFactory(); factory.setUser(USER_NAME); factory.setDataSourceBean("simpleDataSource"); cfg.setCacheStoreFactory(factory); return cfg; }