public boolean refresh() {
synchronized (this) {
CacheConfig oldSnapshot = 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);
}
}