01: package org.shiftone.cache.policy.single;
02:
03: import org.shiftone.cache.Cache;
04: import org.shiftone.cache.CacheFactory;
05: import org.shiftone.cache.util.reaper.ReapableCache;
06:
07: /**
08: * Creates a simple cache that holds only one key/value.
09: * This cache type can be useful for storing a fairly static but still database driven list,
10: * such as a list of countries.
11: * Obviously, this cache doesn't require a very complex implementation. If a cache
12: * will only ever have one value, then this will be the most efficient implementation.
13: *
14: *
15: * @author <a href="mailto:jeff@shiftone.org">Jeff Drost</a>
16: * @version $Revision: 1.6 $
17: */
18: public class SingleCacheFactory implements CacheFactory {
19:
20: // CacheReaper reaper = CacheReaper.getReaper();
21:
22: /**
23: * Method newInstance
24: */
25: public Cache newInstance(String cacheName,
26: long timeoutMilliSeconds, int maxSize) {
27:
28: ReapableCache cache = new SingleCache(timeoutMilliSeconds);
29:
30: //todo reaper.register(cache);
31: return cache;
32: }
33:
34: public String toString() {
35: return "SingleCacheFactory";
36: }
37: }
|