/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package sonia.scm.cache; //~--- non-JDK imports -------------------------------------------------------- import com.google.inject.Singleton; /** * * @author Sebastian Sdorra */ @Singleton public class EhCacheManager implements CacheManager { /** Field description */ public static final String CONFIG = "/config/ehcache.xml"; //~--- constructors --------------------------------------------------------- /** * Constructs ... * */ public EhCacheManager() { cacheManager = new net.sf.ehcache.CacheManager(EhCacheManager.class.getResource(CONFIG)); } //~--- get methods ---------------------------------------------------------- /** * Method description * * * @param key * @param value * @param name * @param * @param * * @return */ @Override public ExtendedCache getExtendedCache(Class key, Class value, String name) { return getCache(key, value, name); } /** * Method description * * * @param key * @param value * @param name * @param * @param * * @return */ @Override public SimpleCache getSimpleCache(Class key, Class value, String name) { return getCache(key, value, name); } /** * Method description * * * @param key * @param value * @param name * @param * @param * * @return */ private EhCache getCache(Class key, Class value, String name) { return new EhCache(cacheManager.getCache(name)); } //~--- fields --------------------------------------------------------------- /** Field description */ private net.sf.ehcache.CacheManager cacheManager; }