1 package org.shiftone.cache.util; 2 3 4 5 import org.shiftone.cache.Cache; 6 import org.shiftone.cache.CacheFactory; 7 import org.shiftone.cache.decorator.sync.SyncCache; 8 import org.shiftone.cache.util.reaper.CacheReaper; 9 import org.shiftone.cache.util.reaper.ReapableCache; 10 11 12 16 public abstract class AbstractPolicyCacheFactory implements CacheFactory 17 { 18 19 private static final Log LOG = new Log(AbstractPolicyCacheFactory.class); 20 private int period = 1000; 21 22 public abstract ReapableCache newReapableCache(String cacheName, long timeoutMilliSeconds, int maxSize); 23 24 25 public Cache newInstance(String cacheName, long timeoutMilliSeconds, int maxSize) 26 { 27 28 return CacheReaper.register( new SyncCache( newReapableCache(cacheName, timeoutMilliSeconds, maxSize)), period); 32 } 33 34 35 42 public int getPeriod() 43 { 44 return period; 45 } 46 47 48 public void setPeriod(int period) 49 { 50 this.period = period; 51 } 52 } 53 | Popular Tags |