1 10 11 package net.sf.cache4j.perfomance.cache; 12 13 import net.sf.cache4j.impl.CacheConfigImpl; 14 import net.sf.cache4j.impl.SynchronizedCache; 15 import net.sf.cache4j.perfomance.ICache; 16 17 23 24 public class cache4j implements ICache { 25 28 private SynchronizedCache _cache; 29 30 32 public static final String NAME = "cache4j 0.4"; 33 34 37 41 public void init() throws Exception { 42 _cache = new SynchronizedCache(); 43 _cache.setCacheConfig(new CacheConfigImpl("cacheId", null, 0, 0, 0, 1000, null, "lru", "strong")); 44 } 45 46 52 public Object get(Object id) throws Exception { 53 return _cache.get(id); 54 } 55 56 62 public void put(Object id, Object value) throws Exception { 63 _cache.put(id, value); 64 } 65 66 71 public void remove(Object id) throws Exception { 72 _cache.remove(id); 73 } 74 75 80 public long size() throws Exception { 81 return _cache.size(); 82 } 83 84 87 public void destroy() { 88 _cache = null; 89 } 90 91 95 public String getCacheName() { 96 return NAME; 97 } 98 99 } | Popular Tags |