public class CacheManagerEhcache extends Object implements CacheManager
Constructor and Description |
---|
CacheManagerEhcache(net.sf.ehcache.CacheManager cacheManager) |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
protected void |
configureCache(String cacheName)
Creates a cache if it doesn't already exist - if the cache has been defined in the configuration xml, then it
will not be recreated.
|
protected void |
configureCaches() |
Object |
get(String key)
Retrieves cached object from the default cache.
|
Object |
get(String cacheName,
Serializable key)
Retrieves cached object.
|
List |
getAllKeys()
Retrieves all keys from the default cache.
|
List |
getAllKeys(String cacheName)
Retrieve all keys from the cache.
|
protected net.sf.ehcache.Cache |
getCache(String cacheName) |
void |
put(String key,
Serializable obj)
Saves object to the default cache
|
void |
put(String cacheName,
Serializable key,
Serializable obj)
Saves object to the cache.
|
boolean |
remove(String key)
Removes cached object from the default cache
|
boolean |
remove(String cacheName,
Serializable key)
Removes cached object from the cache.
|
void |
removeAll()
Remove all the entries from the default cache.
|
void |
removeAll(String cacheName)
Removes all the entries from the given cache.
|
public CacheManagerEhcache(net.sf.ehcache.CacheManager cacheManager)
protected void configureCaches()
protected void configureCache(String cacheName)
cacheName
- Name of the cache to ensure existsprotected net.sf.ehcache.Cache getCache(String cacheName)
public Object get(String key) throws CacheManagerException, NotInCacheException
CacheManager
get
in interface CacheManager
key
- key of the objectCacheManagerException
- if any problems arise during the operationNotInCacheException
- if the key does not existpublic void put(String key, Serializable obj) throws CacheManagerException
CacheManager
put
in interface CacheManager
key
- key of the objectobj
- actual object to be cachedCacheManagerException
- if any problems arise during the operationpublic boolean remove(String key) throws CacheManagerException
CacheManager
remove
in interface CacheManager
key
- key of the objectCacheManagerException
- if any problems arise during the operationpublic void removeAll() throws CacheManagerException
CacheManager
removeAll
in interface CacheManager
CacheManagerException
- if any problems arise during the operationpublic List getAllKeys() throws CacheManagerException
CacheManager
getAllKeys
in interface CacheManager
CacheManagerException
- if any problems arise during the operationpublic void put(String cacheName, Serializable key, Serializable obj) throws CacheManagerException
CacheManager
put
in interface CacheManager
cacheName
- cache namekey
- key of the objectobj
- actual object to be cachedCacheManagerException
- if any problems arise during the operationpublic Object get(String cacheName, Serializable key) throws CacheManagerException, NotInCacheException
CacheManager
get
in interface CacheManager
cacheName
- cache namekey
- key of the objectCacheManagerException
- if any problems arise during the operationNotInCacheException
- if the key does not existpublic boolean remove(String cacheName, Serializable key) throws CacheManagerException
CacheManager
remove
in interface CacheManager
cacheName
- cache namekey
- key of the objectCacheManagerException
- if any problems arise during the operationpublic void removeAll(String cacheName) throws CacheManagerException
CacheManager
removeAll
in interface CacheManager
cacheName
- cache name.CacheManagerException
- if any problems arise during the operationpublic List getAllKeys(String cacheName) throws CacheManagerException
CacheManager
getAllKeys
in interface CacheManager
cacheName
- cache name.CacheManagerException
Copyright © 2013 Atlassian. All Rights Reserved.