42 lines
893 B
C#
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();
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|