概念实现
package net.wendal.nutzbook.util;
import net.sf.ehcache.Cache;
import net.sf.ehcache.Element;
public class SuperCache<K,V> {
protected Cache cache;
public SuperCache(Cache cache) {
this.cache = cache;
}
public void put(K k, V v) {
cache.put(new Element(k, v));
}
@SuppressWarnings("unchecked")
public V get(K k) {
Element ele = cache.get(k);
if (ele == null)
return null;
return (V)ele.getObjectValue();
}
}