Files
lserp_cs_5.0/插件库/Zhaizj.Framework/Caching/CacheManager.cs
T
2026-07-10 15:25:05 +08:00

42 lines
893 B
C#

using System;
using Zhaizj.Framework.Data;
using Zhaizj.Framework.DI;
using Zhaizj.Framework.Web;
namespace Zhaizj.Framework.Caching
{
/// <summary>
/// 缓存管理器
/// </summary>
public class CacheManager
{
/// <summary>
/// 获取 ApplicationCache
/// </summary>
/// <returns></returns>
public static IApplicationCache GetApplicationCache()
{
String cfgCache = DbConfig.Instance.ApplicationCacheManager;
if (strUtil.IsNullOrEmpty(cfgCache)) return defaultCache();
if (ObjectContext.Instance.TypeList.ContainsKey(cfgCache) == false) return defaultCache();
return ObjectContext.GetByType(cfgCache) as IApplicationCache;
}
private static IApplicationCache defaultCache()
{
return new ApplicationCache();
}
}
}