Author: tv
Date: Sun Sep 9 16:21:29 2018
New Revision: 1840422
URL: http://svn.apache.org/viewvc?rev=1840422&view=rev
Log:
Merge branch commons-jcs-2.2.x back into trunk
Modified:
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCache.java
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheConfigurator.java
Modified:
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCache.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCache.java?rev=1840422&r1=1840421&r2=1840422&view=diff
==============================================================================
---
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCache.java
(original)
+++
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCache.java
Sun Sep 9 16:21:29 2018
@@ -583,7 +583,7 @@ public class CompositeCache<K, V>
// based on the element's expiration
policy. The elements attributes
// associated with the item when it
created govern its behavior
// everywhere.
- remove( key );
+ doExpires(element);
element = null;
}
else
@@ -641,6 +641,11 @@ public class CompositeCache<K, V>
return element;
}
+ protected void doExpires(ICacheElement<K, V> element) {
+ missCountExpired.incrementAndGet();
+ remove( element.getKey() );
+ }
+
/**
* Gets multiple items from the cache based on the given set of keys.
* <p>
@@ -747,8 +752,7 @@ public class CompositeCache<K, V>
log.debug( cacheAttr.getCacheName() + " - Memory cache
hit, but element expired" );
}
- missCountExpired.incrementAndGet();
- remove( element.getKey() );
+ doExpires(element);
elementsFromMemory.remove( element.getKey() );
}
else
@@ -1002,13 +1006,11 @@ public class CompositeCache<K, V>
log.debug( cacheAttr.getCacheName() + " - Aux cache["
+ aux.getCacheName() + "] hit, but element expired." );
}
- missCountExpired.incrementAndGet();
-
// This will tell the remote caches to remove the item
// based on the element's expiration policy. The elements
attributes
// associated with the item when it created govern its
behavior
// everywhere.
- remove( element.getKey() );
+ doExpires(element);
elementsFromAuxiliary.remove( element.getKey() );
}
else
Modified:
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheConfigurator.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheConfigurator.java?rev=1840422&r1=1840421&r2=1840422&view=diff
==============================================================================
---
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheConfigurator.java
(original)
+++
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/control/CompositeCacheConfigurator.java
Sun Sep 9 16:21:29 2018
@@ -202,10 +202,10 @@ public class CompositeCacheConfigurator
IElementAttributes ea = parseElementAttributes( props, regName,
ccm.getDefaultElementAttributes(), regionPrefix );
- CompositeCache<K, V> cache = ( cca == null )
- ? new CompositeCache<K, V>( parseCompositeCacheAttributes( props,
regName,
- ccm.getDefaultCacheAttributes(), regionPrefix ), ea )
- : new CompositeCache<K, V>( cca, ea );
+ ICompositeCacheAttributes instantiationCca = cca == null
+ ? parseCompositeCacheAttributes(props, regName,
ccm.getDefaultCacheAttributes(), regionPrefix)
+ : cca;
+ CompositeCache<K, V> cache = newCache(instantiationCca, ea);
// Inject cache manager
cache.setCompositeCacheManager(ccm);
@@ -282,6 +282,12 @@ public class CompositeCacheConfigurator
return cache;
}
+ protected <K, V> CompositeCache<K, V> newCache(
+ ICompositeCacheAttributes cca, IElementAttributes ea)
+ {
+ return new CompositeCache<K, V>( cca, ea );
+ }
+
/**
* Get an ICompositeCacheAttributes for the listed region.
*<p>