/** * @return {@code True} if store is enabled. */ public boolean isStoreEnabled() { return cacheCfg.getStore() != null && !hasFlag(SKIP_STORE); }
/** * @return {@code True} if store enabled. */ private boolean storeEnabled() { return ctx.isStoreEnabled() && ctx.config().getStore() != null; }
/** * Creates a wrapped cache store if write-behind cache is configured. * * @param gridName Grid name. * @param cfg Cache configuration. * @param near Whether or not store retrieved for near cache. * @return Instance if {@link GridCacheWriteBehindStore} if write-behind store is configured, * or user-defined cache store. */ @SuppressWarnings({"unchecked"}) private GridCacheStore cacheStore(String gridName, GridCacheConfiguration cfg, boolean near) { if (cfg.getStore() == null || !cfg.isWriteBehindEnabled()) return cfg.getStore(); // Write-behind store is used in DHT cache only. if (!near) { GridCacheWriteBehindStore store = new GridCacheWriteBehindStore(gridName, cfg.getName(), log, cfg.getStore()); store.setFlushSize(cfg.getWriteBehindFlushSize()); store.setFlushThreadCount(cfg.getWriteBehindFlushThreadCount()); store.setFlushFrequency(cfg.getWriteBehindFlushFrequency()); store.setBatchSize(cfg.getWriteBehindBatchSize()); return store; } else return cfg.getStore(); }
/** * @param ccfg Cache configuration. * @return Data transfer object for cache store configuration properties. */ public static VisorStoreConfig from(GridCacheConfiguration ccfg) { VisorStoreConfig cfg = new VisorStoreConfig(); cfg.store(compactClass(ccfg.getStore())); cfg.valueBytes(ccfg.isStoreValueBytes()); return cfg; }
/** * @param cctx Cache context. */ private void cleanup(GridCacheContext cctx) { GridCacheConfiguration cfg = cctx.config(); cleanup(cfg, cfg.getEvictionPolicy(), false); cleanup(cfg, cfg.getNearEvictionPolicy(), true); cleanup(cfg, cfg.getAffinity(), false); cleanup(cfg, cfg.getAffinityMapper(), false); cleanup(cfg, cctx.jta().tmLookup(), false); cleanup(cfg, cfg.getCloner(), false); cleanup(cfg, cfg.getStore(), false); cctx.cleanup(); }
/** * @param cfg Configuration. * @param objs Extra components. * @throws GridException If failed to inject. */ private void prepare(GridCacheConfiguration cfg, Object... objs) throws GridException { prepare(cfg, cfg.getEvictionPolicy(), false); prepare(cfg, cfg.getNearEvictionPolicy(), true); prepare(cfg, cfg.getAffinity(), false); prepare(cfg, cfg.getAffinityMapper(), false); prepare(cfg, cfg.getCloner(), false); prepare(cfg, cfg.getStore(), false); prepare(cfg, cfg.getEvictionFilter(), false); prepare(cfg, cfg.getInterceptor(), false); GridDrSenderCacheConfiguration drSndCfg = cfg.getDrSenderConfiguration(); if (drSndCfg != null) prepare(cfg, drSndCfg.getEntryFilter(), false); GridDrReceiverCacheConfiguration drRcvCfg = cfg.getDrReceiverConfiguration(); if (drRcvCfg != null) prepare(cfg, drRcvCfg.getConflictResolver(), false); for (Object obj : objs) prepare(cfg, obj, false); }
if (cfg.getStore() != null) perf.add("Enable write-behind to persistent store (set 'writeBehindEnabled' to true)", cfg.isWriteBehindEnabled());
qryIdxEnabled = cfg.isQueryIndexEnabled(); seqReserveSize = cfg.getAtomicSequenceReserveSize(); storeEnabled = cfg.getStore() != null; storeValBytes = cfg.isStoreValueBytes(); swapEnabled = cfg.isSwapEnabled(); evictPlcClsName = className(cfg.getEvictionPolicy()); nearEvictPlcClsName = className(cfg.getNearEvictionPolicy()); storeClsName = className(cfg.getStore()); tmLookupClsName = cfg.getTransactionManagerLookupClassName();
seqReserveSize = cc.getAtomicSequenceReserveSize(); startSize = cc.getStartSize(); store = cc.getStore(); storeValBytes = cc.isStoreValueBytes(); swapEnabled = cc.isSwapEnabled();
if (cc.getStore() == null) throw new GridException("Cannot enable write-behind cache (cache store is not provided) for cache: " + cc.getName());