/ Published in: Java
download Ehcache (www.http://ehcache.org/) from website, unzip it and use ehcache.xml inside root folder
Expand |
Embed | Plain Text
package ilex; import net.sf.ehcache.Cache; import net.sf.ehcache.CacheException; import net.sf.ehcache.CacheManager; import net.sf.ehcache.Element; public class testos2 { static Cache cache = null; static { CacheManager cacheManager = null; try { cacheManager = CacheManager.create("C:/Users/asel/Desktop/MPPSources/MeiboPeoplePack/Packaging/Tools/Meibo/Studio/ehcache.xml"); } catch (CacheException e) { e.printStackTrace(); } cache = cacheManager.getCache("sampleCache1"); } /** * @param args * @throws CacheException * @throws IllegalStateException */ result = doit("a"); } String result; //get an element from cache by key if (e != null) { } else { result = "new value" ; } return result; } }
You need to login to post a comment.
