Package com.tangosol.util
Class ConverterCollections.ConverterCacheMap<FK,TK,FV,TV>
java.lang.Object
com.tangosol.util.ConverterCollections.ConverterMap<FK,TK,FV,TV>
com.tangosol.util.ConverterCollections.ConverterObservableMap<FK,TK,FV,TV>
com.tangosol.util.ConverterCollections.ConverterCacheMap<FK,TK,FV,TV>
- All Implemented Interfaces:
CacheMap<TK,
,TV> ObservableMap<TK,
,TV> Serializable
,Map<TK,
TV>
- Direct Known Subclasses:
ConverterCollections.ConverterNamedCache
- Enclosing class:
ConverterCollections
public static class ConverterCollections.ConverterCacheMap<FK,TK,FV,TV>
extends ConverterCollections.ConverterObservableMap<FK,TK,FV,TV>
implements CacheMap<TK,TV>, Serializable
A Converter CacheMap views an underlying CacheMap through a set of key
and value Converters.
- See Also:
-
Nested Class Summary
-
Field Summary
Fields inherited from class com.tangosol.util.ConverterCollections.ConverterMap
m_convKeyDown, m_convKeyUp, m_convValDown, m_convValUp, m_map, m_set
Fields inherited from interface com.tangosol.net.cache.CacheMap
EXPIRY_DEFAULT, EXPIRY_NEVER
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetAll
(Collection<? extends TK> colKeys) Get all the specified keys, if they are in the cache.Return the underlying CacheMap.Associates the specified value with the specified key in this cache.Methods inherited from class com.tangosol.util.ConverterCollections.ConverterObservableMap
addMapListener, addMapListener, addMapListener, getConverterListener, getObservableMap, removeMapListener, removeMapListener, removeMapListener
Methods inherited from class com.tangosol.util.ConverterCollections.ConverterMap
clear, containsKey, containsValue, entrySet, equals, get, getConverterKeyDown, getConverterKeyUp, getConverterValueDown, getConverterValueUp, getMap, hashCode, instantiateCollection, instantiateEntrySet, instantiateMap, instantiateSet, isEmpty, keySet, put, putAll, remove, size, subMap, toString, values
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
Methods inherited from interface com.tangosol.util.ObservableMap
addMapListener, addMapListener, addMapListener, removeMapListener, removeMapListener, removeMapListener
-
Constructor Details
-
ConverterCacheMap
public ConverterCacheMap(CacheMap<FK, FV> map, Converter<FK, TK> convKeyUp, Converter<TK, FK> convKeyDown, Converter<FV, TV> convValUp, Converter<TV, FV> convValDown) Constructor.- Parameters:
map
- the underlying CacheMapconvKeyUp
- the Converter to view the underlying CacheMap's keys throughconvKeyDown
- the Converter to use to pass keys down to the underlying CacheMapconvValUp
- the Converter to view the underlying CacheMap's values throughconvValDown
- the Converter to use to pass values down to the underlying CacheMap
-
-
Method Details
-
getAll
Get all the specified keys, if they are in the cache. For each key that is in the cache, that key and its corresponding value will be placed in the map that is returned by this method. The absence of a key in the returned map indicates that it was not in the cache, which may imply (for caches that can load behind the scenes) that the requested data could not be loaded.The result of this method is defined to be semantically the same as the following implementation, without regards to threading issues:
Map map = new AnyMap(); // could be a HashMap (but does not have to) for (Iterator iter = colKeys.iterator(); iter.hasNext(); ) { Object oKey = iter.next(); Object oVal = get(oKey); if (oVal != null || containsKey(oKey)) { map.put(oKey, oVal); } } return map;
-
put
Associates the specified value with the specified key in this cache. If the cache previously contained a mapping for this key, the old value is replaced. This variation of theCacheMap.put(Object oKey, Object oValue)
method allows the caller to specify an expiry (or "time to live") for the cache entry.- Specified by:
put
in interfaceCacheMap<FK,
TK> - Parameters:
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified keycMillis
- the number of milliseconds until the cache entry will expire, also referred to as the entry's "time to live"; passCacheMap.EXPIRY_DEFAULT
to use the cache's default time-to-live setting; passCacheMap.EXPIRY_NEVER
to indicate that the cache entry should never expire; this milliseconds value is not a date/time value, such as is returned from System.currentTimeMillis()- Returns:
- previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the map previously associated null with the specified key, if the implementation supports null values
-
getCacheMap
Return the underlying CacheMap.- Returns:
- the underlying CacheMap
-