Package org.shiftone.cache.policy.single

Source Code of org.shiftone.cache.policy.single.SingleCacheFactory

package org.shiftone.cache.policy.single;



import org.shiftone.cache.Cache;
import org.shiftone.cache.CacheFactory;
import org.shiftone.cache.util.reaper.ReapableCache;


/**
* Creates a simple cache that holds only one key/value.
* This cache type can be useful for storing a fairly static but still database driven list,
* such as a list of countries.
* Obviously, this cache doesn't require a very complex implementation.  If a cache
* will only ever have one value, then this will be the most efficient implementation.
*
*
* @author <a href="mailto:jeff@shiftone.org">Jeff Drost</a>
* @version $Revision: 1.6 $
*/
public class SingleCacheFactory implements CacheFactory
{

    //  CacheReaper reaper = CacheReaper.getReaper();

    /**
     * Method newInstance
     */
    public Cache newInstance(String cacheName, long timeoutMilliSeconds, int maxSize)
    {

        ReapableCache cache = new SingleCache(timeoutMilliSeconds);

        //todo reaper.register(cache);
        return cache;
    }


    public String toString()
    {
        return "SingleCacheFactory";
    }
}
TOP

Related Classes of org.shiftone.cache.policy.single.SingleCacheFactory

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.