首页

关于apache的fediz-core源码包中EHCacheUtil缓存工具类获取ehcache的缓存配置对象CacheConfiguration

标签:EHCacheUtil,ehcache缓存工具类,CacheConfiguration,fediz-core     发布时间:2018-04-25   

一、前言

关于apachefediz-core源码包中的org.apache.cxf.fediz.core.EHCacheUtil缓存工具类,通过键值key及net.sf.ehcache.CacheManager获取net.sf.ehcache.config.CacheConfiguration配置对象。

二、源码说明

package org.apache.cxf.fediz.core;@b@@b@import java.util.Map;@b@import net.sf.ehcache.CacheManager;@b@import net.sf.ehcache.config.CacheConfiguration;@b@import net.sf.ehcache.config.Configuration;@b@@b@public final class EHCacheUtil@b@{@b@  public static CacheConfiguration getCacheConfiguration(String key, CacheManager cacheManager)@b@  {@b@    CacheConfiguration cc = (CacheConfiguration)cacheManager.getConfiguration().getCacheConfigurations().get(key);@b@    if ((cc == null) && (key.contains("-"))) {@b@      cc = (CacheConfiguration)cacheManager.getConfiguration().getCacheConfigurations().get(key.substring(0, key.lastIndexOf(45)));@b@    }@b@@b@    if (cc == null)@b@      cc = cacheManager.getConfiguration().getDefaultCacheConfiguration();@b@@b@    if (cc == null)@b@      cc = new CacheConfiguration();@b@    else@b@      cc = cc.clone();@b@@b@    cc.setName(key);@b@    return cc;@b@  }@b@}


<<热门下载>>