// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   DAOCacheManager.java

package com.keyshop.pub.dao;

import com.keyshop.pub.util.CacheManager;
import java.text.MessageFormat;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class DAOCacheManager
{

    private static Log log = LogFactory.getFactory().getInstance("DAOCacheManager");
    private static CacheManager cacheManager = new CacheManager(2);

    public DAOCacheManager()
    {
    }

    public static Object getCache(String identifier)
    {
        if(log.isInfoEnabled())
        {
            Object o[] = {
                new Long(cacheManager.getHitCount()), new Long(cacheManager.getMissCount())
            };
            log.info(MessageFormat.format(" [DAOCacheManager] getCache: {0} hits, {1} misses", o));
        }
        return cacheManager.getCache(identifier);
    }

    public static void putCache(Object object, String id, int minutesToLive)
    {
        if(log.isInfoEnabled())
            log.info(" [DAOCacheManager] putCache");
        cacheManager.putCache(object, id, minutesToLive);
    }

    public static void invalidate(String id)
    {
        cacheManager.invalidate(id);
    }

    public static void clearCache()
    {
        cacheManager.clearCache();
    }

}
