/** * @return Cache mode. */ public CacheMode cacheMode() { CacheMode cacheMode = ccfg.getCacheMode(); return cacheMode != null ? cacheMode : DFLT_CACHE_MODE; }
/** * @return {@code True} if cache is local. */ public boolean isLocal() { return ccfg.getCacheMode() == LOCAL; }
/** * @return {@code True} if cache is local. */ public boolean isReplicated() { return ccfg.getCacheMode() == REPLICATED; }
/** * @return {@code True} if cache is replicated cache. */ public boolean isReplicated() { return cacheCfg.getCacheMode() == CacheMode.REPLICATED; }
/** * @return {@code True} if cache is partitioned cache. */ public boolean isPartitioned() { return cacheCfg.getCacheMode() == CacheMode.PARTITIONED; }
/** * Checks if near cache is enabled for cache configuration. * * @param cfg Cache configuration to check. * @return {@code True} if near cache is enabled, {@code false} otherwise. */ @SuppressWarnings("SimplifiableIfStatement") public static boolean isNearEnabled(CacheConfiguration cfg) { if (cfg.getCacheMode() == LOCAL) return false; return cfg.getNearConfiguration() != null; }
/** {@inheritDoc} */ @Override public String getType() { CacheMode type = ctx.config().getCacheMode(); return String.valueOf(type); }
/** * Collects non local cache group descriptors. * * @return Collection of non local cache group descriptors. */ private List<CacheGroupDescriptor> nonLocalCacheGroupDescriptors() { return cctx.affinity().cacheGroups().values().stream() .filter(grpDesc -> grpDesc.config().getCacheMode() != CacheMode.LOCAL) .collect(Collectors.toList()); }
/** * Gets cache mode. * * @param cacheName Cache name to check. * @return Cache mode. */ public CacheMode cacheMode(String cacheName) { assert cacheName != null; DynamicCacheDescriptor desc = cacheDescriptor(cacheName); return desc != null ? desc.cacheConfiguration().getCacheMode() : null; }
/** * @param cfg Cache configuration. * @return Query manager. */ private GridCacheQueryManager queryManager(CacheConfiguration cfg) { return cfg.getCacheMode() == LOCAL ? new GridCacheLocalQueryManager() : new GridCacheDistributedQueryManager(); }
/** * @return {@code true} If this is a partitioned table. */ public boolean isPartitioned() { return desc != null && desc.cacheInfo().config().getCacheMode() == PARTITIONED; }
/** * @param cache Cache. * @return {@code True} if cache is replicated. */ private boolean replicated(IgniteCache<?, ?> cache) { return cache.getConfiguration(CacheConfiguration.class).getCacheMode() == REPLICATED; }
/** * @return Default cache mode. */ protected CacheMode cacheMode() { CacheMode mode = cacheConfiguration().getCacheMode(); return mode == null ? CacheConfiguration.DFLT_CACHE_MODE : mode; }
/** * @param cache Cache. * @return {@code True} if cache is replicated. */ private boolean replicated(IgniteCache<?, ?> cache) { return cache.getConfiguration(CacheConfiguration.class).getCacheMode() == REPLICATED; }
/** * @param cacheName Cache name. * @return If replicated cache with given name is locally available. */ private boolean replicatedCacheAvailable(String cacheName) { GridCacheAdapter<Object, Object> cache = ctx.cache().internalCache(cacheName); return cache != null && cache.configuration().getCacheMode() == REPLICATED; }
/** {@inheritDoc} */ @Override public CacheQueryFuture<?> queryFieldsDistributed(GridCacheQueryBean qry, Collection<ClusterNode> nodes) { assert cctx.config().getCacheMode() == LOCAL; throw new IgniteException("Distributed queries are not available for local cache " + "(use 'CacheQuery.execute(grid.forLocal())' instead) [cacheName=" + cctx.name() + ']'); } }
/** * @param ctx Context. * @return Managers present in both, DHT and Near caches. */ @SuppressWarnings("IfMayBeConditional") private Collection<GridCacheManager> dhtExcludes(GridCacheContext ctx) { if (ctx.config().getCacheMode() == LOCAL || !isNearEnabled(ctx)) return Collections.emptyList(); else return F.asList(ctx.queries(), ctx.continuousQueries(), ctx.store()); }
/** */ protected boolean isLocalAtomic() { CacheConfiguration cfg = cache.getConfiguration(CacheConfiguration.class); return cfg.getCacheMode() == CacheMode.LOCAL && cfg.getAtomicityMode() == CacheAtomicityMode.ATOMIC; }
/** * @param ccfg Cache configuration. */ private void logCacheInfo(CacheConfiguration<?, ?> ccfg) { log.info("Test cache [mode=" + ccfg.getCacheMode() + ", sync=" + ccfg.getWriteSynchronizationMode() + ", backups=" + ccfg.getBackups() + ", near=" + (ccfg.getNearConfiguration() != null) + ']'); }
/** * @param ccfg Cache configuration. */ private void logCacheInfo(CacheConfiguration<?, ?> ccfg) { log.info("Test cache [mode=" + ccfg.getCacheMode() + ", sync=" + ccfg.getWriteSynchronizationMode() + ", backups=" + ccfg.getBackups() + ", near=" + (ccfg.getNearConfiguration() != null) + ", store=" + ccfg.isWriteThrough() + ", evictPlc=" + (ccfg.getEvictionPolicy() != null) + ']'); }