package li.ehcache;

public class Demo {
    /**
     * 请求路径加QueryString为key,缓存request中的每一个属性
     */
    public static void main(String[] args) {
        System.out.println("hello world");
    }
}
@@ -16,16 +16,143 @@
 che;%0D%0A%0D%0A
+import java.util.List;%0D%0A%0D%0Aimport net.sf.ehcache.Cache;%0D%0Aimport net.sf.ehcache.CacheManager;%0D%0Aimport net.sf.ehcache.Element;%0D%0A%0D%0A
 public c
@@ -160,24 +160,36 @@
 ass Demo %7B%0D%0A
+    %0D%0A    %0D%0A
     /**%0D%0A   
@@ -282,24 +282,24 @@
 %5B%5D args) %7B%0D%0A
-
         Syst
@@ -336,10 +336,1103 @@
 %0D%0A    %7D%0D
+%0A%0D%0A    private CacheManager cacheManager = null;%0D%0A%0D%0A    public Cache get(String name) %7B%0D%0A        Cache cache = cacheManager.getCache(name);%0D%0A        if (cache == null) %7B%0D%0A            synchronized (cacheManager) %7B%0D%0A                cache = cacheManager.getCache(name);%0D%0A                if (cache == null) %7B%0D%0A                    cacheManager.addCacheIfAbsent(name);%0D%0A                    cache = cacheManager.getCache(name);%0D%0A                %7D%0D%0A            %7D%0D%0A        %7D%0D%0A        return cache;%0D%0A    %7D%0D%0A%0D%0A    public void put(String name, Object key, Object value) %7B%0D%0A        get(name).put(new Element(key, value));%0D%0A    %7D%0D%0A%0D%0A    public %3CT%3E T get(String cacheName, Object key) %7B%0D%0A        Element element = get(cacheName).get(key);%0D%0A        return element != null ? (T) element.getObjectValue() : null;%0D%0A    %7D%0D%0A%0D%0A    public List getKeys(String cacheName) %7B%0D%0A        return get(cacheName).getKeys();%0D%0A    %7D%0D%0A%0D%0A    public void remove(String cacheName, Object key) %7B%0D%0A        get(cacheName).remove(key);%0D%0A    %7D%0D%0A%0D%0A    public void removeAll(String cacheName) %7B%0D%0A        get(cacheName).removeAll();%0D%0A    %7D%0D
 %0A%7D

更新Ehcache Demo