public class EhCacheHelper extends Object
Constructor and Description |
---|
EhCacheHelper() |
EhCacheHelper(String configurationFileName) |
Modifier and Type | Method and Description |
---|---|
void |
createCache(String cacheName)
Creates a cache and adds it to the cache manager
|
void |
evictAllCacheElements(String cacheName)
Remove all elements from cache
|
void |
evictCacheElement(String cacheName,
String key)
Removes 1 element from cache
|
net.sf.ehcache.Element |
getCacheElement(String cacheName,
String key)
Gets Element, useful for calling Element methods like getHitCount()
|
long |
getCacheElementHitCount(net.sf.ehcache.Element element)
Gets how many times element has been accessed.
|
Serializable |
getCacheElementValue(String cacheName,
String key)
Get the thing cached
|
String[] |
getCacheNames() |
void |
saveOrUpdateCacheElement(String cacheName,
String key,
Object value)
Like Hibernate's saveOrUpdate, this is used to create a new cache element and update existing element
The cache knows if cache.put if creating or updating an element.
|
public EhCacheHelper()
public EhCacheHelper(String configurationFileName)
public void createCache(String cacheName)
cacheName
- you could name the cache with the classname that uses it.public void saveOrUpdateCacheElement(String cacheName, String key, Object value)
cacheName
- key
- must be unique, should be descriptivevalue
- the thing cachedpublic Serializable getCacheElementValue(String cacheName, String key)
cacheName
- key
- public net.sf.ehcache.Element getCacheElement(String cacheName, String key)
cacheName
- key
- public void evictCacheElement(String cacheName, String key)
cacheName
- key
- public void evictAllCacheElements(String cacheName)
cacheName
- public long getCacheElementHitCount(net.sf.ehcache.Element element)
element
- public String[] getCacheNames()
Copyright © 2004-2014 The Kuali Foundation. All Rights Reserved.