public boolean equals(Object o) { if (!(o instanceof ImmutableConfig)) { return false; } ImmutableConfig config = (ImmutableConfig) o; return getName().equals(config.getName()) && (getMaxTTISeconds() == config.getMaxTTISeconds()) && (getMaxTTLSeconds() == config.getMaxTTLSeconds()) && (isOrphanEvictionEnabled() == config.isOrphanEvictionEnabled()) && (getOrphanEvictionPeriod() == config.getOrphanEvictionPeriod()) && (isLoggingEnabled() == config.isLoggingEnabled()) && (getTargetMaxInMemoryCount() == config.getTargetMaxInMemoryCount()) && (getTargetMaxTotalCount() == config.getTargetMaxTotalCount()); }
public boolean isEvictionEnabled() { return getMaxTTISeconds() > 0 || getMaxTTLSeconds() > 0; }
private int customLifespanExpiresAt() { CacheConfig customConfig = new ImmutableConfig("custom", false, timeToIdle, timeToLive, false, 0, 0, 0, null); return super.expiresAt(customConfig); } }
private static CacheConfig getDefaultConfig() { MutableConfig config = new MutableConfig(); config.setMaxTTISeconds(0); config.setMaxTTLSeconds(0); config.setOrphanEvictionEnabled(false); ImmutableConfig rv = new ImmutableConfig(config); if (rv.isEvictionEnabled()) { throw new AssertionError("Eviction is enabled? " + config); } return rv; }
public StoreImpl(CacheConfig config) { config = (config instanceof ImmutableConfig) ? config : new ImmutableConfig(config); this.data = new DistributedCacheImpl<String, V>(config); }
public boolean refresh() { // read <autolock>'d synchronized (this) { CacheConfig oldSnapshot = snapshot; // don't use the ImmutableConfig(Config) constructor; it would read the snapshot... snapshot = new ImmutableConfig(name, loggingEnabled, maxTTISeconds, maxTTLSeconds, orphanEvictionEnabled, orphanEvictionPeriod, targetMaxInMemoryCount, targetMaxTotalCount, capacityEvictionPolicyDataFactory); if (oldSnapshot != null) { fireChangeEventIfNeeded("name", oldSnapshot.getName(), name); fireChangeEventIfNeeded("loggingEnabled", oldSnapshot.isLoggingEnabled(), loggingEnabled); fireChangeEventIfNeeded("maxTTISeconds", oldSnapshot.getMaxTTISeconds(), maxTTISeconds); fireChangeEventIfNeeded("maxTTLSeconds", oldSnapshot.getMaxTTLSeconds(), maxTTLSeconds); fireChangeEventIfNeeded("orphanEvictionEnabled", oldSnapshot.isOrphanEvictionEnabled(), orphanEvictionEnabled); fireChangeEventIfNeeded("orphanEvictionPeriod", oldSnapshot.getOrphanEvictionPeriod(), orphanEvictionPeriod); fireChangeEventIfNeeded("targetMaxInMemoryCount", oldSnapshot.getTargetMaxInMemoryCount(), targetMaxInMemoryCount); fireChangeEventIfNeeded("targetMaxTotalCount", oldSnapshot.getTargetMaxTotalCount(), targetMaxTotalCount); fireChangeEventIfNeeded("capacityEvictionPolicyDataFactory", oldSnapshot.getCapacityEvictionPolicyDataFactory(), capacityEvictionPolicyDataFactory); } return !snapshot.equals(oldSnapshot); } }