Package com.tangosol.coherence.jcache
Class CoherenceBasedCacheManager
java.lang.Object
com.tangosol.coherence.jcache.CoherenceBasedCacheManager
- All Implemented Interfaces:
Disposable
,Closeable
,AutoCloseable
,javax.cache.CacheManager
public class CoherenceBasedCacheManager
extends Object
implements javax.cache.CacheManager, Disposable
The Coherence-based implementation of a
CacheManager
.- Author:
- jf 2013.06.18, bo 2013.12.17
-
Constructor Summary
ConstructorDescriptionCoherenceBasedCacheManager
(CoherenceBasedCachingProvider provider, ConfigurableCacheFactory ccf, URI uri, ClassLoader classLoader, Properties properties) Constructs a newCoherenceBasedCacheManager
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Default implementation invokesDisposable.dispose()
, it is not recommended that this be overridden.<K,
V, C extends javax.cache.configuration.Configuration<K, V>>
javax.cache.Cache<K, V> createCache
(String sJCacheName, C cfgJCache) void
destroyCache
(String sName) void
dispose()
Invoked when all resources owned by the implementer can safely be released.void
enableManagement
(String sName, boolean fEnabled) void
enableStatistics
(String sName, boolean fEnabled) javax.cache.Cache
<K,
V> javax.cache.Cache <K, V> Provide access to meta cache that maps JCache cache names to JCache configuration.javax.cache.spi.CachingProvider
Get ConfigurableCacheFactory context.getURI()
boolean
isClosed()
void
putCacheToConfigurationMapping
(JCacheIdentifier cacheId, CoherenceBasedCompleteConfiguration config) put entry with key of sNamevoid
releaseCache
(String sName) release cache namedsName
void
remove entry with key of sNametoString()
<T> T
boolean
validate()
Validate if configurations map is valid with this instance.
-
Constructor Details
-
CoherenceBasedCacheManager
public CoherenceBasedCacheManager(CoherenceBasedCachingProvider provider, ConfigurableCacheFactory ccf, URI uri, ClassLoader classLoader, Properties properties) Constructs a newCoherenceBasedCacheManager
.- Parameters:
provider
- theCachingProvider
that owns theCacheManager
ccf
- theConfigurableCacheFactory
to use forCoherenceBasedCache
suri
- theURI
of theCacheManager
(this must point to a valid Coherence Cache configuration file)classLoader
- theClassLoader
to use for loadingCache
resources, including keys, values, loaders, writers etcproperties
- the custom configurationProperties
-
-
Method Details
-
getCacheToConfigurationMapping
Provide access to meta cache that maps JCache cache names to JCache configuration. The mapping is a string to a JCache Configuration object.- Parameters:
cacheId
- JCache unique identifier- Returns:
- a named cache that maps JCache cache names to JCache configurations.
-
putCacheToConfigurationMapping
public void putCacheToConfigurationMapping(JCacheIdentifier cacheId, CoherenceBasedCompleteConfiguration config) put entry with key of sName- Parameters:
cacheId
- key of entry to put into _metaJCacheNameToConfig
-
removeCacheToConfigurationMapping
remove entry with key of sName- Parameters:
cacheId
- key of entry to remove from _metaJCacheNameToConfig
-
getCachingProvider
public javax.cache.spi.CachingProvider getCachingProvider()- Specified by:
getCachingProvider
in interfacejavax.cache.CacheManager
-
getURI
- Specified by:
getURI
in interfacejavax.cache.CacheManager
-
getProperties
- Specified by:
getProperties
in interfacejavax.cache.CacheManager
-
getClassLoader
- Specified by:
getClassLoader
in interfacejavax.cache.CacheManager
-
createCache
public <K,V, javax.cache.Cache<K,C extends javax.cache.configuration.Configuration<K, V>> V> createCache(String sJCacheName, C cfgJCache) throws IllegalArgumentException - Specified by:
createCache
in interfacejavax.cache.CacheManager
- Throws:
IllegalArgumentException
-
getCache
public <K,V> javax.cache.Cache<K,V> getCache(String sJCacheName, Class<K> clzKey, Class<V> clzType) - Specified by:
getCache
in interfacejavax.cache.CacheManager
-
getCache
- Specified by:
getCache
in interfacejavax.cache.CacheManager
-
getCacheNames
- Specified by:
getCacheNames
in interfacejavax.cache.CacheManager
-
destroyCache
- Specified by:
destroyCache
in interfacejavax.cache.CacheManager
-
enableStatistics
- Specified by:
enableStatistics
in interfacejavax.cache.CacheManager
-
enableManagement
- Specified by:
enableManagement
in interfacejavax.cache.CacheManager
-
close
public void close()Description copied from interface:Disposable
Default implementation invokesDisposable.dispose()
, it is not recommended that this be overridden.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfacejavax.cache.CacheManager
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceDisposable
-
dispose
public void dispose()Description copied from interface:Disposable
Invoked when all resources owned by the implementer can safely be released.Once disposed of the object should no longer be considered to be usable.
Note the Disposable interface is compatible with try-with-resources which will automatically invoke this method.
- Specified by:
dispose
in interfaceDisposable
-
isClosed
public boolean isClosed()- Specified by:
isClosed
in interfacejavax.cache.CacheManager
-
unwrap
- Specified by:
unwrap
in interfacejavax.cache.CacheManager
-
getConfigurableCacheFactory
Get ConfigurableCacheFactory context.- Returns:
ConfigurableCacheFactory
-
releaseCache
release cache namedsName
- Parameters:
sName
- JCache Adapter map to release
-
validate
public boolean validate()Validate if configurations map is valid with this instance.- Returns:
- true iff it is valid
-
toString
-