mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 15:05:44 +01:00
create new caches dynamically
This commit is contained in:
@@ -84,12 +84,20 @@ public class EhCacheManager implements CacheManager
|
||||
@Override
|
||||
public <K, V> Cache<K, V> getCache(Class<K> key, Class<V> value, String name)
|
||||
{
|
||||
if (logger.isInfoEnabled())
|
||||
net.sf.ehcache.Cache c = cacheManager.getCache(name);
|
||||
|
||||
if (c == null)
|
||||
{
|
||||
logger.info("create new cache {}", name);
|
||||
if (logger.isWarnEnabled())
|
||||
{
|
||||
logger.warn("could not find cache {}, create new from defaults", name);
|
||||
}
|
||||
|
||||
cacheManager.addCacheIfAbsent(name);
|
||||
c = cacheManager.getCache(name);
|
||||
}
|
||||
|
||||
return new EhCache<K, V>(cacheManager.getCache(name), name);
|
||||
return new EhCache<K, V>(c, name);
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user