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
ConstructorsConstructorDescriptionCoherenceBasedCacheManager(CoherenceBasedCachingProvider provider, ConfigurableCacheFactory ccf, URI uri, ClassLoader classLoader, Properties properties) Constructs a newCoherenceBasedCacheManager. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()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) voiddestroyCache(String sName) voiddispose()Invoked when all resources owned by the implementer can safely be released.voidenableManagement(String sName, boolean fEnabled) voidenableStatistics(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.CachingProviderGet ConfigurableCacheFactory context.getURI()booleanisClosed()voidputCacheToConfigurationMapping(JCacheIdentifier cacheId, CoherenceBasedCompleteConfiguration config) put entry with key of sNamevoidreleaseCache(String sName) release cache namedsNamevoidremove entry with key of sNametoString()<T> Tbooleanvalidate()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- theCachingProviderthat owns theCacheManagerccf- theConfigurableCacheFactoryto use forCoherenceBasedCachesuri- theURIof theCacheManager(this must point to a valid Coherence Cache configuration file)classLoader- theClassLoaderto use for loadingCacheresources, 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:
getCachingProviderin interfacejavax.cache.CacheManager
-
getURI
- Specified by:
getURIin interfacejavax.cache.CacheManager
-
getProperties
- Specified by:
getPropertiesin interfacejavax.cache.CacheManager
-
getClassLoader
- Specified by:
getClassLoaderin 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:
createCachein 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:
getCachein interfacejavax.cache.CacheManager
-
getCache
- Specified by:
getCachein interfacejavax.cache.CacheManager
-
getCacheNames
- Specified by:
getCacheNamesin interfacejavax.cache.CacheManager
-
destroyCache
- Specified by:
destroyCachein interfacejavax.cache.CacheManager
-
enableStatistics
- Specified by:
enableStatisticsin interfacejavax.cache.CacheManager
-
enableManagement
- Specified by:
enableManagementin interfacejavax.cache.CacheManager
-
close
public void close()Description copied from interface:DisposableDefault implementation invokesDisposable.dispose(), it is not recommended that this be overridden.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfacejavax.cache.CacheManager- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceDisposable
-
dispose
public void dispose()Description copied from interface:DisposableInvoked 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:
disposein interfaceDisposable
-
isClosed
public boolean isClosed()- Specified by:
isClosedin interfacejavax.cache.CacheManager
-
unwrap
- Specified by:
unwrapin 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
-