Package org.wso2.carbon.caching.impl
Class CarbonCacheManager
java.lang.Object
org.wso2.carbon.caching.impl.CarbonCacheManager
- All Implemented Interfaces:
CacheManager
TODO: class description
-
Constructor Summary
ConstructorsConstructorDescriptionCarbonCacheManager(String name, CacheManagerFactoryImpl cacheManagerFactory) -
Method Summary
Modifier and TypeMethodDescription<K,V> CacheBuilder <K, V> createCacheBuilder(String cacheName) Creates a newCacheBuilderfor the named cache to be managed by this cache manager.boolean<K,V> Cache <K, V> Looks up a named cache.Returns an Iterable over the caches managed by this CacheManager.getName()Get the name of this cache managerintReturns the status of this CacheManager.inthashCode()booleanisSupported(OptionalFeature optionalFeature) Indicates whether a optional feature is supported by this CacheManager.booleanremoveCache(String cacheName) Remove a cache from the CacheManager.voidshutdown()Shuts down the CacheManager.<T> TReturn an object of the specified type to allow access to the provider-specific API.
-
Constructor Details
-
CarbonCacheManager
-
-
Method Details
-
getOwnerTenantId
public int getOwnerTenantId() -
getName
Description copied from interface:CacheManagerGet the name of this cache manager- Specified by:
getNamein interfaceCacheManager- Returns:
- the name of this cache manager
-
getStatus
Description copied from interface:CacheManagerReturns the status of this CacheManager. Calls to this method will block while the state is changing.- Specified by:
getStatusin interfaceCacheManager- Returns:
- one of
Status
-
createCacheBuilder
Description copied from interface:CacheManagerCreates a newCacheBuilderfor the named cache to be managed by this cache manager. An example which creates a cache using default cache configuration is:Cache<Integer, Date> myCache2 = cacheManager. <Integer, Date>createCacheBuilder("myCache2"). build();An example usage which programmatically sets many parameters ofCacheConfiguration, specifies aCacheLoaderand registrs listeners is:Cache<Integer, String> myCache1 = cacheManager. <Integer, String>createCacheBuilder("myCache1"). setCacheLoader(cl). setStoreByValue(true). setReadThrough(true). setWriteThrough(false). setStatisticsEnabled(true). setTransactionEnabled(false). registerCacheEntryListener(listener1, NotificationScope.LOCAL, false). registerCacheEntryListener(listener2, NotificationScope.LOCAL, false). build();The returned CacheBuilder is associated with this CacheManager. The Cache will be created, added to the caches controlled by this CacheManager and started whenCacheBuilder.build()is called. If there is an existing Cache of the same name associated with this CacheManager when build is invoked, an exception is thrown.- Specified by:
createCacheBuilderin interfaceCacheManager- Parameters:
cacheName- the name of the cache to build. A cache name must consist of at least one non-whitespace character.- Returns:
- the CacheBuilder for the named cache
-
getCache
Description copied from interface:CacheManagerLooks up a named cache.- Specified by:
getCachein interfaceCacheManager- Parameters:
cacheName- the name of the cache to look for- Returns:
- the Cache or null if it does exist
-
getCaches
Description copied from interface:CacheManagerReturns an Iterable over the caches managed by this CacheManager. The Iterable is immutable (iterator.remove will throw an IllegalStateException) and independent of the cache manager; if the caches managed by the cache manager change the Iterable is not affected- Specified by:
getCachesin interfaceCacheManager- Returns:
- an Iterable over the managed Caches
-
removeCache
Description copied from interface:CacheManagerRemove a cache from the CacheManager. The cache will be stopped.- Specified by:
removeCachein interfaceCacheManager- Parameters:
cacheName- the cache name- Returns:
- true if the cache was removed
-
isSupported
Description copied from interface:CacheManagerIndicates whether a optional feature is supported by this CacheManager.- Specified by:
isSupportedin interfaceCacheManager- Parameters:
optionalFeature- the feature to check for- Returns:
- true if the feature is supported
-
shutdown
public void shutdown()Description copied from interface:CacheManagerShuts down the CacheManager. For each cache in the cache manager theCacheLifecycle.stop()method will be invoked, in no guaranteed order. If the stop throws an exception, the exception is ignored. Calls toCacheManager.getStatus()will block until shutdown completes. On completion the CacheManager's status is changed toStatus.STOPPED, and the manager's owned caches will be empty andCacheManager.getCaches()will return an empty collection. A given CacheManager instance cannot be restarted after it has been stopped. A new one must be created.- Specified by:
shutdownin interfaceCacheManager
-
unwrap
Description copied from interface:CacheManagerReturn an object of the specified type to allow access to the provider-specific API. If the provider's implementation does not support the specified class, theIllegalArgumentExceptionis thrown.- Specified by:
unwrapin interfaceCacheManager- Parameters:
cls- the class of the object to be returned. This is normally either the underlying implementation class or an interface that it implements.- Returns:
- an instance of the specified class
-
equals
-
hashCode
public int hashCode()
-