Class RemoteCache<K,V>
- java.lang.Object
-
- com.tangosol.coherence.jcache.AbstractCoherenceBasedCache<K,V,RemoteCacheConfiguration<K,V>>
-
- com.tangosol.coherence.jcache.remotecache.RemoteCache<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>
public class RemoteCache<K,V> extends AbstractCoherenceBasedCache<K,V,RemoteCacheConfiguration<K,V>>
A remote partitioned-cache implementation of aCache
based on a Coherence <partitioned-cache>.- Since:
- 12.2.1
- Author:
- jf 2014.05.21
-
-
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
Constructors Constructor Description RemoteCache(CoherenceBasedCacheManager manager, String sJCacheName, RemoteCacheConfiguration configuration)
Constructs aRemoteCache
configured byPartitionedCacheConfiguration
in context ofCoherenceBasedCacheManager
with JCache namesJCacheName
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
void
close()
boolean
containsKey(K key)
void
deregisterCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
void
destroy()
Destroys aCoherenceBasedCache
due to a request from aCoherenceBasedCacheManager
.V
get(K key)
Map<K,V>
getAll(Set<? extends K> keys)
V
getAndPut(K key, V value)
V
getAndRemove(K key)
V
getAndReplace(K key, V value)
<T extends javax.cache.configuration.Configuration<K,V>>
TgetConfiguration(Class<T> clz)
JCacheIdentifier
getIdentifier()
Obtain the internal identifier used for JCache caches.javax.cache.management.CacheMXBean
getMBean()
Get JMX Bean associated with Cache.JCacheStatistics
getStatistics()
Get JCache Statistics associated with Cache.<T> T
invoke(K key, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... arguments)
<T> Map<K,javax.cache.processor.EntryProcessorResult<T>>
invokeAll(Set<? extends K> keys, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... arguments)
boolean
isStatisticsEnabled()
Get JCache Statistics statusIterator<javax.cache.Cache.Entry<K,V>>
iterator()
void
loadAll(Set<? extends K> keys, boolean replaceExistingValues, javax.cache.integration.CompletionListener completionListener)
void
onBeforeClosing()
Closes aCoherenceBasedCache
at the request of a call toCache.close()
.void
put(K key, V value)
void
putAll(Map<? extends K,? extends V> map)
boolean
putIfAbsent(K key, V value)
void
registerCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
boolean
remove(K key)
boolean
remove(K key, V oldValue)
void
removeAll()
void
removeAll(Set<? extends K> keys)
boolean
replace(K key, V value)
boolean
replace(K key, V oldValue, V newValue)
void
setManagementEnabled(boolean fEnabled)
Set JCache Management status.void
setStatisticsEnabled(boolean fEnabled)
Set JCache statistics status<T> T
unwrap(Class<T> clz)
-
Methods inherited from class com.tangosol.coherence.jcache.AbstractCoherenceBasedCache
ensureOpen, getCacheManager, getClassLoader, getName, isClosed
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
RemoteCache
public RemoteCache(CoherenceBasedCacheManager manager, String sJCacheName, RemoteCacheConfiguration configuration)
Constructs aRemoteCache
configured byPartitionedCacheConfiguration
in context ofCoherenceBasedCacheManager
with JCache namesJCacheName
.- Parameters:
manager
- CacheManager manages the created RemoteCache.sJCacheName
- JCache cache name that must be unique withinCoherenceBasedCacheManager
contextconfiguration
- remote JCache cache configuration
-
-
Method Detail
-
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,RemoteCacheConfiguration<K,V>>
-
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,RemoteCacheConfiguration<K,V>>
- Returns:
- JMX Bean
-
getStatistics
public JCacheStatistics getStatistics()
Description copied from class:AbstractCoherenceBasedCache
Get JCache Statistics associated with Cache.- Specified by:
getStatistics
in classAbstractCoherenceBasedCache<K,V,RemoteCacheConfiguration<K,V>>
- Returns:
- JCache Statistics if exist or null.
-
setManagementEnabled
public void setManagementEnabled(boolean fEnabled)
Description copied from class:AbstractCoherenceBasedCache
Set JCache Management status.- Specified by:
setManagementEnabled
in classAbstractCoherenceBasedCache<K,V,RemoteCacheConfiguration<K,V>>
- Parameters:
fEnabled
- true to enable
-
setStatisticsEnabled
public void setStatisticsEnabled(boolean fEnabled)
Description copied from class:AbstractCoherenceBasedCache
Set JCache statistics status- Specified by:
setStatisticsEnabled
in classAbstractCoherenceBasedCache<K,V,RemoteCacheConfiguration<K,V>>
- Parameters:
fEnabled
- true to enable
-
isStatisticsEnabled
public boolean isStatisticsEnabled()
Description copied from class:AbstractCoherenceBasedCache
Get JCache Statistics status- Specified by:
isStatisticsEnabled
in classAbstractCoherenceBasedCache<K,V,RemoteCacheConfiguration<K,V>>
- Returns:
- true if enabled, otherwise false
-
getIdentifier
public JCacheIdentifier 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,RemoteCacheConfiguration<K,V>>
- Returns:
- the internal
JCacheIdentifier
-
destroy
public void destroy()
Description copied from interface:CoherenceBasedCache
Destroys aCoherenceBasedCache
due to a request from aCoherenceBasedCacheManager
.
-
containsKey
public boolean containsKey(K key)
-
loadAll
public void loadAll(Set<? extends K> keys, boolean replaceExistingValues, javax.cache.integration.CompletionListener completionListener)
-
remove
public boolean remove(K key)
-
removeAll
public void removeAll()
-
clear
public void clear()
-
invoke
public <T> T invoke(K key, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... arguments) throws javax.cache.processor.EntryProcessorException
- Throws:
javax.cache.processor.EntryProcessorException
-
invokeAll
public <T> Map<K,javax.cache.processor.EntryProcessorResult<T>> invokeAll(Set<? extends K> keys, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... arguments)
-
registerCacheEntryListener
public void registerCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
-
deregisterCacheEntryListener
public void deregisterCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfacejavax.cache.Cache<K,V>
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classAbstractCoherenceBasedCache<K,V,RemoteCacheConfiguration<K,V>>
-
getConfiguration
public <T extends javax.cache.configuration.Configuration<K,V>> T getConfiguration(Class<T> clz)
- Specified by:
getConfiguration
in interfacejavax.cache.Cache<K,V>
- Overrides:
getConfiguration
in classAbstractCoherenceBasedCache<K,V,RemoteCacheConfiguration<K,V>>
-
unwrap
public <T> T unwrap(Class<T> clz)
- Specified by:
unwrap
in interfacejavax.cache.Cache<K,V>
- Overrides:
unwrap
in classAbstractCoherenceBasedCache<K,V,RemoteCacheConfiguration<K,V>>
-
-