This is the get function, getCacheControl()
is returning a IMemoryCache<K, V>
implementation.
https://github.com/apache/commons-jcs/blob/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/access/CacheAccess.java
@Override
public V get( K name )
{
ICacheElement<K, V> element = this.getCacheControl().get( name );
return ( element != null ) ? element.getVal() : null;
}
AbstractMemoryCache implementing IMemoryCache and using a Map,
https://github.com/apache/commons-jcs/blob/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractMemoryCache.java
/** Map where items are stored by key. This is created by the concrete child class. */
public Map<K, MemoryElementDescriptor<K, V>>
So we can assume similar semantics. Composite objects should not make any difference, maybe you forgot to override hashCode
. Map first uses it to find the bucket, later uses equals
.