1 package org.shiftone.cache.adaptor; 2 3 4 5 import net.sf.hibernate.cache.CacheException; 6 import net.sf.hibernate.cache.Timestamper; 7 8 9 15 public class HibernateCache implements net.sf.hibernate.cache.Cache 16 { 17 18 private final org.shiftone.cache.Cache cache; 19 20 public HibernateCache(org.shiftone.cache.Cache cache) 21 { 22 this.cache = cache; 23 } 24 25 26 public final Object get(Object key) throws CacheException 27 { 28 return cache.getObject(key); 29 } 30 31 32 public final void put(Object key, Object value) throws CacheException 33 { 34 cache.addObject(key, value); 35 } 36 37 38 public final void remove(Object key) throws CacheException 39 { 40 cache.remove(key); 41 } 42 43 44 public final void clear() throws CacheException 45 { 46 cache.clear(); 47 } 48 49 50 public final void destroy() throws CacheException 51 { 52 cache.clear(); 53 } 54 55 56 59 public final void lock(Object o) throws CacheException {} 60 61 62 65 public final void unlock(Object o) throws CacheException {} 66 67 68 public final long nextTimestamp() 69 { 70 return Timestamper.next(); 71 } 72 73 74 public final int getTimeout() 75 { 76 return 1; 77 } 78 } 79 | Popular Tags |