KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > shiftone > cache > policy > single > SingleCacheFactory


1 package org.shiftone.cache.policy.single;
2
3
4
5 import org.shiftone.cache.Cache;
6 import org.shiftone.cache.CacheFactory;
7 import org.shiftone.cache.util.reaper.ReapableCache;
8
9
10 /**
11  * Creates a simple cache that holds only one key/value.
12  * This cache type can be useful for storing a fairly static but still database driven list,
13  * such as a list of countries.
14  * Obviously, this cache doesn't require a very complex implementation. If a cache
15  * will only ever have one value, then this will be the most efficient implementation.
16  *
17  *
18  * @author <a HREF="mailto:jeff@shiftone.org">Jeff Drost</a>
19  * @version $Revision: 1.6 $
20  */

21 public class SingleCacheFactory implements CacheFactory
22 {
23
24     // CacheReaper reaper = CacheReaper.getReaper();
25

26     /**
27      * Method newInstance
28      */

29     public Cache newInstance(String JavaDoc cacheName, long timeoutMilliSeconds, int maxSize)
30     {
31
32         ReapableCache cache = new SingleCache(timeoutMilliSeconds);
33
34         //todo reaper.register(cache);
35
return cache;
36     }
37
38
39     public String JavaDoc toString()
40     {
41         return "SingleCacheFactory";
42     }
43 }
44
Popular Tags