|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface CacheManager
A CacheManager is used for looking up Caches and controls their lifecycle. It represents a collection of caches. To the extent that implementations have configuration at the CacheManager level, it is a way for these caches to share common configuration. For example a CacheManager might be clustered so all caches in that CacheManager will participate in the same cluster.
CacheManagers are created byCacheManagerFactory.
Implementations may also support creation directly through CacheManager constructors which may be simpler to use
where multiple vendor implementations are present.
TODO (yannis): Not clear what this means in a prescriptive sense; implementations may, and indeed always do, support any number of constructors for concrete classes, as well as implement methods beyond the spec. Why do we need to enumerate them.
| Method Summary | ||
|---|---|---|
void |
addCache(Cache<?,?> cache)
Adds an uninitialised Cache to the CacheManager and starts it. |
|
|
createCacheBuilder(String cacheName)
Creates a new CacheBuilder for the named cache to be managed by this cache manager. |
|
|
getCache(String cacheName)
Looks up a named cache. |
|
String |
getName()
Get the name of this cache manager |
|
Object |
getUserTransaction()
This method will return a UserTransaction. |
|
boolean |
removeCache(String cacheName)
Remove a cache from the CacheManager. |
|
void |
shutdown()
Shuts down the CacheManager. |
|
| Method Detail |
|---|
String getName()
<K,V> CacheBuilder<K,V> createCacheBuilder(String cacheName)
CacheBuilder for the named cache to be managed by this cache manager.
Example usage
cacheManager.createCacheBuilder("myCache").
setCacheConfiguration(config).
setCacheLoader(cl).
build();
The returned CacheBuilder is associated with this CacheManager.
The Cache will be created, added to the caches controlled by this CacheManager and started when
CacheBuilder.build() is called.
If there is an existing Cache of the same name associated with this CacheManager when build is invoked,
the old Cache will be stopped.
cacheName - the name of the cache to build
IllegalStateException - if the cache is not Status.UNITIALISED before this method is called.
CacheException - if there was an error adding the cache to the CacheManagervoid addCache(Cache<?,?> cache)
Cache to the CacheManager and starts it.
If a cache with the same name has been previously added that cache will be stopped.
TODO (yannis): Not clear why this is required.
cache - the cache to add
IllegalStateException - if the cache is not Status.UNITIALISED before this method is called.
CacheException - if there was an error adding the cache to the CacheManager<K,V> Cache<K,V> getCache(String cacheName)
cacheName - the name of the cache to look for
IllegalStateException - if the Cache is not Status.STARTED
boolean removeCache(String cacheName)
throws IllegalStateException
cacheName - the cache name
IllegalStateException - if the cache is not Status.STARTEDObject getUserTransaction()
void shutdown()
Status.STOPPING. As they are shut down their status is change to Status.STOPPED. Finally
the CacheManager's status is changed to Status.STOPPED
A IllegalStateException will be thrown if an operation is performed on CacheManager or any contained Cache while
they are stopping or are a stopped.
A given CacheManager instance cannot be restarted after it has been stopped. A new one must be created.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||