public interface CacheManager
extends java.io.Closeable
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Transitions this
CacheManager to UNINITIALIZED. |
<K,V> Cache<K,V> |
createCache(java.lang.String alias,
Builder<? extends CacheConfiguration<K,V>> configBuilder)
Creates a
Cache in this CacheManager according to the specified CacheConfiguration provided
through a Builder. |
<K,V> Cache<K,V> |
createCache(java.lang.String alias,
CacheConfiguration<K,V> config)
|
<K,V> Cache<K,V> |
getCache(java.lang.String alias,
java.lang.Class<K> keyType,
java.lang.Class<V> valueType)
Retrieves the
Cache associated with the given alias, if one is known. |
Configuration |
getRuntimeConfiguration()
Returns the current
Configuration used by this CacheManager. |
Status |
getStatus()
Returns the current
Status of this CacheManager. |
void |
init()
Transitions this
CacheManager to AVAILABLE. |
void |
removeCache(java.lang.String alias)
Removes the
Cache associated with the alias provided, if one is known. |
<K,V> Cache<K,V> createCache(java.lang.String alias, CacheConfiguration<K,V> config)
Cache in this CacheManager according to the specified CacheConfiguration.
The returned Cache will be in status AVAILABLE.
K - the key type for the cacheV - the value type for the cachealias - the alias under which the cache will be createdconfig - the configuration of the cache to createCachejava.lang.IllegalArgumentException - if there is already a cache registered with the given aliasjava.lang.IllegalStateException - if the cache creation fails<K,V> Cache<K,V> createCache(java.lang.String alias, Builder<? extends CacheConfiguration<K,V>> configBuilder)
Cache in this CacheManager according to the specified CacheConfiguration provided
through a Builder.
The returned Cache will be in status AVAILABLE.
K - the key type for the cacheV - the value type for the cachealias - the alias under which the cache will be createdconfigBuilder - the builder for the configuration of the cache to createCachejava.lang.IllegalArgumentException - if there is already a cache registered with the given aliasjava.lang.IllegalStateException - if the cache creation fails<K,V> Cache<K,V> getCache(java.lang.String alias, java.lang.Class<K> keyType, java.lang.Class<V> valueType)
Cache associated with the given alias, if one is known.K - the key type for the cacheV - the value type for the cachealias - the alias under which to look the Cache upkeyType - the Cache key classvalueType - the Cache value classCache associated with the given alias, null if no such cache existsjava.lang.IllegalArgumentException - if the keyType or valueType do not match the ones with which the
Cache was createdvoid removeCache(java.lang.String alias)
Cache associated with the alias provided, if one is known.
When the cache is removed, it will release all resources it used.
alias - the alias for which to remove the Cachevoid init() throws StateTransitionException
CacheManager to AVAILABLE.
This will start all Services managed by this CacheManager, as well
as initializing all Caches registered with it.
If an error occurs before the CacheManager is AVAILABLE, it will revert to
UNINITIALIZED attempting to close all services it had already started.
java.lang.IllegalStateException - if the CacheManager is not UNINITIALIZEDStateTransitionException - if the CacheManager could not be made AVAILABLEvoid close()
throws StateTransitionException
CacheManager to UNINITIALIZED.
This will close all Caches known to this CacheManager and stop all
Services managed by this CacheManager.
Failure to close any Cache or to stop any Service will not prevent others from being closed or
stopped.
close in interface java.lang.AutoCloseableclose in interface java.io.CloseableStateTransitionException - if the CacheManager could not reach UNINITIALIZED cleanlyjava.lang.IllegalStateException - if the CacheManager is not AVAILABLEStatus getStatus()
Status of this CacheManager.StatusConfiguration getRuntimeConfiguration()
Configuration used by this CacheManager.CacheManager