public virtual ICache GetCacher(string name)
        {
            ICache cache = cacheDic.TryGetValue(name);

            if (cache == null)
            {
                SettingNode node = cacheNodes.TryGetValue(name);

                if (node == null)
                {
                    cache = CacheUtil.GetDefaultCache();
                }
                else
                {
                    cache = CacheUtil.TryCreateCache(node, "type");
                    List <SettingNode> settingNodes = new List <SettingNode>()
                    {
                        node
                    };
                    settingNodes.Add(ToolSection.Instance.TryGetNode("cache/specifiableFactory"));
                    settingNodes.Add(ToolSection.Instance.TryGetNode("cache"));

                    CacheUtil.InitCache(cache, CacheUtil.GetCacheSettingNode(settingNodes, cache));
                }
                if (cache is AbstractCache)
                {
                    ((AbstractCache)cache).CacheName = name;
                }

                cacheDic[name] = cache;
            }
            return(cache);
        }
Esempio n. 2
0
        public ICache GetCacher(string name)
        {
            ICache cache = CacheUtil.GetDefaultCache();

            if (cache is AbstractCache)
            {
                ((AbstractCache)cache).CacheName = name;
            }
            return(cache);
        }