Class CoherenceCache
- java.lang.Object
-
- com.oracle.coherence.spring.cache.CoherenceCache
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.springframework.cache.Cache
Cache.ValueRetrievalException, Cache.ValueWrapper
-
-
Constructor Summary
Constructors Constructor Description CoherenceCache(com.tangosol.net.NamedCache<Object,Object> cache, CoherenceCacheConfiguration cacheConfiguration)
Construct the CoherenceCache.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
void
evict(Object key)
Cache.ValueWrapper
get(Object key)
<T> T
get(Object key, Class<T> type)
<T> T
get(Object key, Callable<T> valueLoader)
Return the value to which this cache maps the specified key.CoherenceCacheConfiguration
getCacheConfiguration()
Return the usedCoherenceCacheConfiguration
.String
getName()
Object
getNativeCache()
void
put(Object key, Object value)
int
size()
Returns the number of key-value mappings of the underlyingNamedCache
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.springframework.cache.Cache
evictIfPresent, invalidate, putIfAbsent
-
-
-
-
Constructor Detail
-
CoherenceCache
public CoherenceCache(com.tangosol.net.NamedCache<Object,Object> cache, CoherenceCacheConfiguration cacheConfiguration)
Construct the CoherenceCache.- Parameters:
cache
- must not be nullcacheConfiguration
- must not be null
-
-
Method Detail
-
get
public Cache.ValueWrapper get(Object key)
-
get
public <T> T get(Object key, Callable<T> valueLoader)
Return the value to which this cache maps the specified key. If the key does not exist in the cache, the method will obtain that value using the provided valueLoader. In that case, the key will be locked, unlessCoherenceCacheConfiguration.isUseLocks()
returns false.- Specified by:
get
in interfaceCache
- Type Parameters:
T
- type of the return value.- Parameters:
key
- might be null. SeeMap.get(Object)
.valueLoader
- must not be null.- Returns:
- the value from the cache.
-
getNativeCache
public Object getNativeCache()
- Specified by:
getNativeCache
in interfaceCache
-
size
public int size()
Returns the number of key-value mappings of the underlyingNamedCache
.- Returns:
- the number of key-value mappings in this map
-
getCacheConfiguration
public CoherenceCacheConfiguration getCacheConfiguration()
Return the usedCoherenceCacheConfiguration
.- Returns:
- never returns
null
.
-
-