/** * {@inheritDoc} */ public org.infinispan.configuration.cache.Configuration getCacheConfiguration() { return parentCache.getCacheConfiguration(); }
/** * Indicates whether the given cache is configured to cluster its contents. * A cache is considered to clustered if it's configured with any cache mode * except {@link org.infinispan.configuration.cache.CacheMode#LOCAL} * * @param cache to check whether it clusters its contents * @return true if the cache is configured with clustering, false otherwise */ public static boolean isClustered(AdvancedCache cache) { return cache.getCacheConfiguration() .clustering().cacheMode().isClustered(); }
/** * Indicates whether the given cache is configured with * {@link org.infinispan.configuration.cache.CacheMode#INVALIDATION_ASYNC} or * {@link org.infinispan.configuration.cache.CacheMode#INVALIDATION_SYNC}. * * @param cache to check for invalidation configuration * @return true if the cache is configured with invalidation, false otherwise */ public static boolean isInvalidationCache(AdvancedCache cache) { return cache.getCacheConfiguration() .clustering().cacheMode().isInvalidation(); }
public TreeCacheImpl(AdvancedCache<?, ?> cache) { super(cache, cache.getBatchContainer()); if (cache.getCacheConfiguration().indexing().index().isEnabled()) throw new CacheConfigurationException("TreeCache cannot be used with a Cache instance configured to use indexing!"); assertBatchingSupported(cache.getCacheConfiguration()); createRoot(); }
@ManagedName("MaxEntries") @ManagedDescription("Maximum number of entries in a cache instance. -1 means no limit.") public int getMaxSize() { return cache.getCacheConfiguration().eviction().maxEntries(); }
protected void checkAccessType(AccessType accessType) { if (accessType == AccessType.TRANSACTIONAL && !cache.getCacheConfiguration().transaction().transactionMode().isTransactional()) { log.transactionalStrategyNonTransactionalCache(); } else if (accessType == AccessType.READ_WRITE && cache.getCacheConfiguration().transaction().transactionMode().isTransactional()) { log.readWriteStrategyTransactionalCache(); } }
public InfinispanCache(org.infinispan.Cache<K, V> cacheStore, String cacheName, ClassLoader classloader) { assert(cacheStore != null); this.cacheStore = cacheStore.getAdvancedCache(); TransactionMode transactionMode = this.cacheStore.getCacheConfiguration().transaction().transactionMode(); this.transactional = transactionMode == TransactionMode.TRANSACTIONAL; LogManager.logDetail(LogConstants.CTX_RUNTIME, "Added", transactionMode, "infinispan cache", cacheName); //$NON-NLS-1$ //$NON-NLS-2$ this.name = cacheName; this.classloader = classloader; }
@ManagedName("Lifespan") @ManagedDescription("Maximum lifespan of a cache entry, after which the entry is expired cluster-wide." + " -1 means the entries never expire.") public long getLiveTime() { return cache.getCacheConfiguration().expiration().lifespan(); }
@ManagedName("Lifespan") @ManagedDescription("Maximum lifespan of a cache entry, after which the entry is expired cluster-wide." + " -1 means the entries never expire.") public long getLiveTime() { return cache.getCacheConfiguration().expiration().lifespan(); }
public void testQuickCache() { assertEquals(quickCache.getCacheConfiguration().eviction().maxEntries(), 1000); assertEquals(quickCache.getCacheConfiguration().expiration().wakeUpInterval(), 1); } }
public MemcachedDecoder(AdvancedCache<byte[], byte[]> memcachedCache, ScheduledExecutorService scheduler, NettyTransport transport, Predicate<? super String> ignoreCache, MediaType valuePayload) { super(MemcachedDecoderState.DECODE_HEADER); this.cache = (AdvancedCache<byte[], byte[]>) memcachedCache.withMediaType(TEXT_PLAIN_TYPE, valuePayload.toString()); this.scheduler = scheduler; this.transport = transport; this.ignoreCache = ignoreCache; isStatsEnabled = cache.getCacheConfiguration().jmxStatistics().enabled(); }
public void testTinyCache() { // Check that we have the correctly configured cache assertEquals(tinyCache.getCacheConfiguration().eviction().maxEntries(), 1); }
public void testSmallCache() { // Check that we have the correctly configured cache assertEquals(smallCache.getCacheConfiguration().memory().size(), 10); } }
@Managed @ManagedName("WakeUpInterval") @ManagedDescription("Interval between subsequent eviction runs. If you wish to disable the periodic eviction " + "process altogether, set wakeupInterval to -1.") public long getWakeUpInterval() { return cache.getCacheConfiguration().expiration().wakeUpInterval(); } }
@Managed @ManagedName("MaxIdle") @ManagedDescription("Maximum idle time a cache entry will be maintained in the cache. " + "If the idle time is exceeded, the entry will be expired cluster-wide. -1 means the entries never expire.") public long getMaxIdle() { return cache.getCacheConfiguration().expiration().maxIdle(); }
@Managed @ManagedName("WakeUpInterval") @ManagedDescription("Interval between subsequent eviction runs. If you wish to disable the periodic eviction " + "process altogether, set wakeupInterval to -1.") public long getWakeUpInterval() { return cache.getCacheConfiguration().expiration().wakeUpInterval(); }
public void testQuickCache() { assertEquals(quickCache.getCacheConfiguration().memory().size(), 1000); assertEquals(quickCache.getCacheConfiguration().expiration().wakeUpInterval(), 1); } }
private CacheTopology getCounterCacheTopology(EmbeddedCacheManager cacheManager) { AdvancedCache<?, ?> cache = cacheManager.getCache(CounterModuleLifecycle.COUNTER_CACHE_NAME).getAdvancedCache(); return cache.getCacheConfiguration().clustering().cacheMode().isClustered() ? cache.getComponentRegistry().getDistributionManager().getCacheTopology() : null; //local cache }
private boolean isTxCache() { return advancedCache(0, cacheName).getCacheConfiguration().transaction().transactionMode().isTransactional(); } }
public static <K, V> MapCollectableCloseableIterable<K, V> entrySet(AdvancedCache<K, V> cache, KeyValueFilter<K, V> filter) { if (cache.getCacheConfiguration().transaction().transactionMode().isTransactional()) { // Dummy read to enlist the LocalTransaction as workaround for ISPN-5676 cache.containsKey(false); } // HHH-10023: we can't use values() CloseableIterator<CacheEntry<K, V>> iterator = Closeables.iterator( cache.cacheEntrySet().stream().filter(CacheFilters.predicate(filter))); return new MapCollectableCloseableIterableImpl<K, V>(iterator); }