/** * setTimeToIdleSeconds * * @param tti */ public void setTimeToIdleSeconds(long tti) { cacheConfiguration.setTimeToIdleSeconds(tti); }
/** * Builder which sets the time to idle for an element before it expires. Is only used if the element is not eternal. * This default can be overridden in {@link net.sf.ehcache.Element} * <p> * This property can be modified dynamically while the cache is operating. * * @param timeToIdleSeconds the default amount of time to live for an element from its last accessed or modified date * @return this configuration instance * @see #setTimeToIdleSeconds(long) */ public final CacheConfiguration timeToIdleSeconds(long timeToIdleSeconds) { setTimeToIdleSeconds(timeToIdleSeconds); return this; }
/** * {@inheritDoc} */ public void setRegionCacheMaxTTISeconds(String region, int maxTTISeconds) { Cache cache = this.cacheManager.getCache(region); if (cache != null) { cache.getCacheConfiguration().setTimeToIdleSeconds(maxTTISeconds); sendNotification(CACHE_REGION_CHANGED, getRegionCacheAttributes(region), region); } }
/** * {@inheritDoc} */ @Override public void setTimeToIdleSeconds(long tti) { if (getTimeToIdleSeconds() != tti) { try { cache.getCacheConfiguration().setTimeToIdleSeconds(tti); } catch (RuntimeException e) { throw Utils.newPlainException(e); } } }
/** * Sets whether elements are eternal. If eternal, timeouts are ignored and the element is never expired. False by default. * * @param eternal true for eternal */ public final void setEternal(boolean eternal) { checkDynamicChange(); isEternalValueConflictingWithTTIOrTTL(eternal, getTimeToLiveSeconds(), getTimeToIdleSeconds()); this.eternal = eternal; if (eternal) { setTimeToIdleSeconds(0); setTimeToLiveSeconds(0); } }
/** * setTimeToIdleSeconds * * @param tti */ public void setTimeToIdleSeconds(long tti) { cacheConfiguration.setTimeToIdleSeconds(tti); }
/** * setTimeToIdleSeconds * * @param tti */ public void setTimeToIdleSeconds(long tti) { cacheConfiguration.setTimeToIdleSeconds(tti); }
/** * setTimeToIdleSeconds * * @param tti */ public void setTimeToIdleSeconds(long tti) { cacheConfiguration.setTimeToIdleSeconds(tti); }
public void setTimeToIdleSeconds( int timeToIdleSeconds ) { if ( this.ehcache != null ) { this.ehcache.getCacheConfiguration().setTimeToIdleSeconds( timeToIdleSeconds ); } this.timeToIdleSeconds = timeToIdleSeconds; }
/** * Sets the time to idle for an element before it expires. Is only used if the element is not eternal. * * @param timeToIdleSeconds the default amount of time to live for an element from its last accessed or modified date */ public void setTimeToIdleSeconds(long timeToIdleSeconds) { cache.getCacheConfiguration().setTimeToIdleSeconds(timeToIdleSeconds); }
/** * Sets the time to idle for an element before it expires. Is only used if the element is not * eternal. * * @param timeToIdleSeconds the default amount of time to live for an element from its last * accessed or modified date */ public void setTimeToIdleSeconds(long timeToIdleSeconds) { cache.getCacheConfiguration().setTimeToIdleSeconds(timeToIdleSeconds); }
@Override public final boolean updateExpireAfterAccess(long expireAfter, @Nonnull TimeUnit timeUnit) { delegate.getCacheConfiguration().setTimeToIdleSeconds(timeUnit.toSeconds(expireAfter)); return true; }
@Override public ToolkitCacheInternal<String, Serializable> getOrCreateToolkitCache(final Ehcache cache) { final String cacheManagerName = getCacheManagerName(cache); final String cacheName = cache.getName(); ToolkitCacheInternal<String, Serializable> toolkitCache = getOrCreateRegularToolkitCache( cacheManagerName, cacheName, cache.getCacheConfiguration()); if(wanUtil.isWanEnabledCache(cacheManagerName, cacheName)) { final boolean replicaCache = wanUtil.isCacheReplica(cacheManagerName, cacheName); final boolean bidirectional = wanUtil.isCacheBidirectional(cacheManagerName, cacheName); toolkitCache = createWanAwareToolkitCache(cacheManagerName, cacheName, toolkitCache, cache.getCacheConfiguration(), !replicaCache, bidirectional); if (replicaCache) { LOGGER.info("Pinning the Cache '{}' belonging to Cache Manager '{}' " + "and setting its TTI and TTL values to zero as it is a WAN Replica Cache. " + "This cache's capacity will be controlled by its Master cache.", cacheName, cacheManagerName); PinningConfiguration pinningConfiguration = new PinningConfiguration(); pinningConfiguration.setStore(PinningConfiguration.Store.INCACHE.toString()); cache.getCacheConfiguration().addPinning(pinningConfiguration); cache.getCacheConfiguration().setMaxEntriesInCache(0); cache.getCacheConfiguration().setTimeToLiveSeconds(0); cache.getCacheConfiguration().setTimeToIdleSeconds(0); } cache.getCacheConfiguration().freezeConfiguration(); wanWatchdog.watch((Watchable) toolkitCache); } return toolkitCache; }
/** * {@inheritDoc} */ public void setRegionCacheMaxTTISeconds(String region, int maxTTISeconds) { Cache cache = this.cacheManager.getCache(region); if (cache != null) { cache.getCacheConfiguration().setTimeToIdleSeconds(maxTTISeconds); sendNotification(CACHE_REGION_CHANGED, getRegionCacheAttributes(region), region); } }
/** * {@inheritDoc} */ public void setRegionCacheMaxTTISeconds(String region, int maxTTISeconds) { Cache cache = this.cacheManager.getCache(region); if (cache != null) { cache.getCacheConfiguration().setTimeToIdleSeconds(maxTTISeconds); sendNotification(CACHE_REGION_CHANGED, getRegionCacheAttributes(region), region); } }
/** * {@inheritDoc} */ public void setRegionCacheMaxTTISeconds(String region, int maxTTISeconds) { Cache cache = this.cacheManager.getCache(region); if (cache != null) { cache.getCacheConfiguration().setTimeToIdleSeconds(maxTTISeconds); sendNotification(CACHE_REGION_CHANGED, getRegionCacheAttributes(region), region); } }
/** * {@inheritDoc} */ public void setTimeToIdleSeconds(long tti) { if (getTimeToIdleSeconds() != tti) { try { cache.getCacheConfiguration().setTimeToIdleSeconds(tti); } catch (RuntimeException e) { throw Utils.newPlainException(e); } } }
/** * {@inheritDoc} */ @Override public void setTimeToIdleSeconds(long tti) { if (getTimeToIdleSeconds() != tti) { try { cache.getCacheConfiguration().setTimeToIdleSeconds(tti); } catch (RuntimeException e) { throw Utils.newPlainException(e); } } }
/** * {@inheritDoc} */ @Override public void setTimeToIdleSeconds(long tti) { if (getTimeToIdleSeconds() != tti) { try { cache.getCacheConfiguration().setTimeToIdleSeconds(tti); } catch (RuntimeException e) { throw Utils.newPlainException(e); } } }
/** * Sets whether elements are eternal. If eternal, timeouts are ignored and the element is never expired. False by default. * * @param eternal true for eternal */ public final void setEternal(boolean eternal) { checkDynamicChange(); isEternalValueConflictingWithTTIOrTTL(eternal, getTimeToLiveSeconds(), getTimeToIdleSeconds()); this.eternal = eternal; if (eternal) { setTimeToIdleSeconds(0); setTimeToLiveSeconds(0); } }