|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.ehcache.CacheManager
Manages all aspects of EHCache
Field Summary | |
static int |
STATUS_ALIVE
Store alive status. |
static int |
STATUS_SHUTDOWN
Store disposed status. |
static int |
STATUS_UNINITIALISED
Store alive status. |
Method Summary | |
void |
addCache(Cache cache)
Use this to add a Cache . |
void |
addCache(java.lang.String cacheName)
Use this to add a Cache . |
boolean |
cacheExists(java.lang.String cacheName)
Checks whether a cache exists. |
static CacheManager |
create()
A factory method to create a CacheManager with default config. |
static CacheManager |
create(java.lang.String configurationFileName)
A factory method to create a CacheManager with a specified configuration. |
static CacheManager |
create(java.net.URL configurationFileURL)
A factory method to create a CacheManager from an URL. |
Cache |
getCache(java.lang.String name)
Gets a Cache |
java.lang.String[] |
getCacheNames()
Returns a list of the current cache names. |
(package private) Configuration |
getConfiguration()
Returns configuration to classes in this package. |
static CacheManager |
getInstance()
A factory method to get an instance ofCacheManager. |
int |
getStatus()
Gets the status of the CacheManager. |
void |
removeCache(java.lang.String cacheName)
Remove a cache from the CacheManager |
void |
shutdown()
Each call to create() must ultimately be matched by a call
to this method. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int STATUS_UNINITIALISED
public static final int STATUS_ALIVE
public static final int STATUS_SHUTDOWN
Method Detail |
public static CacheManager create() throws CacheException
The configuration will be read, Cache
s created and required stores initialized.
When the CacheManager
is no longer required, call shutdown to free resources.
CacheException
public static CacheManager getInstance() throws CacheException
This has the same effect as create()
CacheException
public static CacheManager create(java.lang.String configurationFileName) throws CacheException
configurationFileName
- an xml file compliant with the ehcache.xsd schema
The configuration will be read, Cache
s created and required stores initialized.
When the CacheManager
is no longer required, call shutdown to free resources.
CacheException
public static CacheManager create(java.net.URL configurationFileURL) throws CacheException
This method makes it possible to specify ehcache.xml, or a differently named config file in the classpath. e.g. this.getClass().getResource(...)
configurationFileURL
- an URL to an xml file compliant with the ehcache.xsd schema
The configuration will be read, Cache
s created and required stores initialized.
When the CacheManager
is no longer required, call shutdown to free resources.
CacheException
public Cache getCache(java.lang.String name) throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if the cache is not STATUS_ALIVE
public void addCache(java.lang.String cacheName) throws java.lang.IllegalStateException, ObjectExistsException, CacheException
Cache
.
Memory and Disk stores will be configured for it and it will be added
to the map of caches.
It will be created with the defaultCache attributes specified in ehcache.xml
cacheName
- the name for the cache
ObjectExistsException
- if the cache already exists
CacheException
- if there was an error creating the cache.
java.lang.IllegalStateException
public void addCache(Cache cache) throws java.lang.IllegalStateException, ObjectExistsException, CacheException
Cache
.
Memory and Disk stores will be configured for it and it will be added
to the map of caches.
cache
-
java.lang.IllegalStateException
- if the cache is not STATUS_ALIVE
ObjectExistsException
- if the cache already exists
CacheException
- if there was an error creating the cache.public boolean cacheExists(java.lang.String cacheName) throws java.lang.IllegalStateException
cacheName
- the cache name to check for
java.lang.IllegalStateException
- if the cache is not STATUS_ALIVE
public void removeCache(java.lang.String cacheName) throws java.lang.IllegalStateException
cacheName
- the cache name
java.lang.IllegalStateException
- if the cache is not STATUS_ALIVE
public void shutdown()
create()
must ultimately be matched by a call
to this method. A count of instance calls is kept and understood to be the number
of clients accessing this CacheManager
.
This is the contract with CacheManager clients.
public java.lang.String[] getCacheNames() throws java.lang.IllegalStateException
String
s
java.lang.IllegalStateException
- if the cache is not STATUS_ALIVE
Configuration getConfiguration() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if the cache is not STATUS_ALIVE
public int getStatus()
STATUS_UNINITIALISED
, STATUS_ALIVE
,
STATUS_SHUTDOWN
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |