|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.kuali.student.common.util.EhCacheHelper
public class EhCacheHelper
Simplified api for enabling Service and DAO classes with EhCache.
Field Summary | |
---|---|
private net.sf.ehcache.CacheManager |
cacheManager
|
Constructor Summary | |
---|---|
EhCacheHelper()
|
|
EhCacheHelper(String configurationFileName)
|
Method Summary | |
---|---|
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()
|
private void |
initCacheManager()
EhCache has a default configuration file within ehcache.jar which is used if there is no ehcache.xml in the classpath. |
private void |
initCacheManager(String configurationFileName)
|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private net.sf.ehcache.CacheManager cacheManager
Constructor Detail |
---|
public EhCacheHelper()
public EhCacheHelper(String configurationFileName)
Method Detail |
---|
private void initCacheManager(String configurationFileName)
private void initCacheManager()
for default configuration
,
To customize configuration, add an ehcache.xml file to the classpath.
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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |