Class LocalCache<K,V>
java.lang.Object
com.tangosol.coherence.jcache.AbstractCoherenceBasedCache<K,V,LocalCacheConfiguration<K,V>>
com.tangosol.coherence.jcache.localcache.LocalCache<K,V>
- Type Parameters:
K
- key typeV
- value type
- All Implemented Interfaces:
CoherenceBasedCache<K,
,V> Closeable
,AutoCloseable
,Iterable<javax.cache.Cache.Entry<K,
,V>> javax.cache.Cache<K,
V>
An in-process local cache implementation of a
Cache
based
on a Coherence <local-cache>.- Since:
- Coherence 12.1.3
- Author:
- jf 2013.12.17, bko 2013.12.17
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
JCache Entry iteratorNested classes/interfaces inherited from interface javax.cache.Cache
javax.cache.Cache.Entry<K,
V> -
Field Summary
Fields inherited from class com.tangosol.coherence.jcache.AbstractCoherenceBasedCache
m_configuration, m_manager, m_namedCache, m_sJCacheName
Fields inherited from interface com.tangosol.coherence.jcache.CoherenceBasedCache
JCACHE_CONFIG_BACK_SCHEME_NAME, JCACHE_CONFIG_BACK_SCHEME_SERVICE_NAME, JCACHE_CONFIG_CACHE_NAME, JCACHE_CONFIG_SCHEME_NAME, JCACHE_CONFIG_SERVICE_NAME, JCACHE_EXTEND_PROXY_SERVICE_NAME, JCACHE_EXTEND_SCHEME_NAME, JCACHE_EXTEND_SERVICE_NAME, JCACHE_LOCAL_CACHE_NAME_PATTERN, JCACHE_LOCAL_CACHE_NAME_PREFIX, JCACHE_LOCAL_SCHEME_NAME, JCACHE_LOCAL_SERVICE_NAME, JCACHE_PARTITIONED_CACHE_NAME_PATTERN, JCACHE_PARTITIONED_CACHE_NAME_PREFIX, JCACHE_PARTITIONED_SCHEME_NAME, JCACHE_PARTITIONED_SERVICE_NAME, JCACHE_REMOTE_SCHEME
-
Constructor Summary
ConstructorDescriptionLocalCache
(CoherenceBasedCacheManager manager, String sJCacheName, LocalCacheConfiguration<K, V> configuration) Constructs aLocalCache
configured byLocalCacheConfiguration
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
containsKey
(K key) void
deregisterCacheEntryListener
(javax.cache.configuration.CacheEntryListenerConfiguration<K, V> config) void
destroy()
Destroys aCoherenceBasedCache
due to a request from aCoherenceBasedCacheManager
.void
dispatch
(CoherenceCacheEventEventDispatcher<K, V> dispatcher) dispatch outstanding JCache EventsgetAndRemove
(K key) getAndReplace
(K key, V value) Get the JCache context for this JCache's operationsObtain the internal identifier used for JCache caches.Get key converter for this.javax.cache.management.CacheMXBean
getMBean()
Get JMX Bean associated with Cache.Get asynchronous CacheEntryEventListeners.Get synchronous CacheEntryEventListeners.Get JCache statistics.Get value converter for this.<T> T
invokeAll
(Set<? extends K> setKey, javax.cache.processor.EntryProcessor<K, V, T> proc, Object... arguments) boolean
Get JCache Statistics statusiterator()
void
loadAll
(Set<? extends K> setKeys, boolean fReplaceExistingValues, javax.cache.integration.CompletionListener listener) void
Closes aCoherenceBasedCache
at the request of a call toCache.close()
.void
processExpiries
(K key, CoherenceCacheEventEventDispatcher<K, V> dispatcher) Process expiry for entry of key.void
processExpiries
(K keyExpired, V valueExpired, CoherenceCacheEventEventDispatcher<K, V> dispatcher) Dispatch an ExpiryEvent to registered CacheEntryListeners.void
void
boolean
putIfAbsent
(K key, V value) void
registerCacheEntryListener
(javax.cache.configuration.CacheEntryListenerConfiguration<K, V> config) boolean
boolean
void
void
boolean
boolean
void
setManagementEnabled
(boolean fEnabled) Set JCache Management status.void
setStatisticsEnabled
(boolean fEnabled) Set JCache statistics statustoString()
Methods inherited from class com.tangosol.coherence.jcache.AbstractCoherenceBasedCache
close, ensureOpen, getCacheManager, getClassLoader, getConfiguration, getName, isClosed, unwrap
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
LocalCache
public LocalCache(CoherenceBasedCacheManager manager, String sJCacheName, LocalCacheConfiguration<K, V> configuration) Constructs aLocalCache
configured byLocalCacheConfiguration
.- Parameters:
manager
- theCoherenceBasedCacheManager
that created theLocalCache
sJCacheName
- the JCache Name for theLocalCache
configuration
- theLocalCacheConfiguration
for theLocalCache
-
-
Method Details
-
onBeforeClosing
public void onBeforeClosing()Description copied from class:AbstractCoherenceBasedCache
Closes aCoherenceBasedCache
at the request of a call toCache.close()
.- Specified by:
onBeforeClosing
in classAbstractCoherenceBasedCache<K,
V, LocalCacheConfiguration<K, V>>
-
getStatistics
Get JCache statistics.- Specified by:
getStatistics
in classAbstractCoherenceBasedCache<K,
V, LocalCacheConfiguration<K, V>> - Returns:
JCacheStatistics
if enabled, null otherwise
-
isStatisticsEnabled
public boolean isStatisticsEnabled()Description copied from class:AbstractCoherenceBasedCache
Get JCache Statistics status- Specified by:
isStatisticsEnabled
in classAbstractCoherenceBasedCache<K,
V, LocalCacheConfiguration<K, V>> - Returns:
- true if enabled, otherwise false
-
setStatisticsEnabled
public void setStatisticsEnabled(boolean fEnabled) Description copied from class:AbstractCoherenceBasedCache
Set JCache statistics status- Specified by:
setStatisticsEnabled
in classAbstractCoherenceBasedCache<K,
V, LocalCacheConfiguration<K, V>> - Parameters:
fEnabled
- true to enable
-
setManagementEnabled
public void setManagementEnabled(boolean fEnabled) Description copied from class:AbstractCoherenceBasedCache
Set JCache Management status.- Specified by:
setManagementEnabled
in classAbstractCoherenceBasedCache<K,
V, LocalCacheConfiguration<K, V>> - Parameters:
fEnabled
- true to enable
-
getMBean
public javax.cache.management.CacheMXBean getMBean()Description copied from class:AbstractCoherenceBasedCache
Get JMX Bean associated with Cache.- Specified by:
getMBean
in classAbstractCoherenceBasedCache<K,
V, LocalCacheConfiguration<K, V>> - Returns:
- JMX Bean
-
getRegisteredSynchronousEventListeners
public CopyOnWriteArraySet<CoherenceCacheEntryListenerRegistration<K,V>> getRegisteredSynchronousEventListeners()Get synchronous CacheEntryEventListeners.- Returns:
- synchronous CacheEntryEventListenerRegistrations
-
getRegisteredAsynchronousEventListeners
public CopyOnWriteArraySet<CoherenceCacheEntryListenerRegistration<K,V>> getRegisteredAsynchronousEventListeners()Get asynchronous CacheEntryEventListeners.- Returns:
- asynchronous CacheEntryEventListenerRegistrations
-
processExpiries
Process expiry for entry of key. Dispatch ExpiryEvent(s) to dispatcher.- Parameters:
key
- key of entry to be expired.dispatcher
- dispatcher for ExpiryEvent.
-
processExpiries
public void processExpiries(K keyExpired, V valueExpired, CoherenceCacheEventEventDispatcher<K, V> dispatcher) Dispatch an ExpiryEvent to registered CacheEntryListeners.- Parameters:
keyExpired
- key of expired entryvalueExpired
- value of expired entrydispatcher
- dispatch EXPIRED CacheEntryEvent to registered listeners of this cache.
-
getContext
Get the JCache context for this JCache's operations- Returns:
- JCacheContext
-
getKeyConverter
Get key converter for this.- Returns:
- keyConverter
-
getValueConverter
Get value converter for this.- Returns:
- valueConverter value converter for this.
-
dispatch
dispatch outstanding JCache Events- Parameters:
dispatcher
- outstanding JCache events
-
get
-
getAll
-
containsKey
-
loadAll
-
put
-
putIfAbsent
-
getAndPut
-
putAll
-
remove
-
remove
-
getAndRemove
-
replace
-
replace
-
getAndReplace
-
removeAll
-
removeAll
public void removeAll() -
clear
public void clear() -
invoke
-
invokeAll
-
registerCacheEntryListener
-
deregisterCacheEntryListener
-
iterator
-
getIdentifier
Description copied from interface:CoherenceBasedCache
Obtain the internal identifier used for JCache caches.- Specified by:
getIdentifier
in interfaceCoherenceBasedCache<K,
V> - Specified by:
getIdentifier
in classAbstractCoherenceBasedCache<K,
V, LocalCacheConfiguration<K, V>> - Returns:
- the internal
JCacheIdentifier
-
destroy
public void destroy()Description copied from interface:CoherenceBasedCache
Destroys aCoherenceBasedCache
due to a request from aCoherenceBasedCacheManager
. -
toString
-