| 1 package org.shiftone.cache.decorator.cluster; 2 3 4 5 import org.shiftone.cache.Cache; 6 import org.shiftone.cache.util.Log; 7 8 9 13 public class ClusterCache implements Cache 14 { 15 16 private final Log LOG = new Log(ClusterCache.class); 17 private final ClusterCacheFactory factory; 18 private final Cache cache; 19 private final String name; 20 21 public ClusterCache(String name, Cache cache, ClusterCacheFactory factory) 22 { 23 24 this.factory = factory; 25 this.cache = cache; 26 this.name = name; 27 } 28 29 30 public void addObject(Object userKey, Object cacheObject) 31 { 32 33 cache.addObject(userKey, cacheObject); 35 } 36 37 38 public Object getObject(Object key) 39 { 40 return cache.getObject(key); 41 } 42 43 44 public int size() 45 { 46 return cache.size(); 47 } 48 49 50 public void remove(Object key) 51 { 52 cache.remove(key); 53 factory.sendRemoveNotification(name, key); 54 } 55 56 57 public void clear() 58 { 59 cache.clear(); 60 factory.sendClearNotification(name); 61 } 62 63 64 public Cache getCache() 66 { 67 return cache; 68 } 69 70 71 public String getName() 72 { 73 return name; 74 } 75 76 77 public final String toString() 79 { 80 return "ClusterCache->" + cache; 81 } 82 } 83 | Popular Tags |