Discuz.Cache/DefaultCacheStrategy.cs
(开头部分) 7KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Web;
using System.Collections;
using System.Web.Caching;
namespace Discuz.Cache
{
abstract public class LogVisitor
{
abstract public void WriteLog(DefaultCacheStrategy dcs, string key, object val, CacheItemRemovedReason reason);
protected static int m_IsWriteCachelog = 1;
public int IsWriteCacheLog
{
set { m_IsWriteCachelog = value; }
get { return m_IsWriteCachelog; }
}
}
/// <summary>
/// 默认缓存管理类
/// </summary>
public class DefaultCacheStrategy : ICacheStrategy
{
protected static volatile System.Web.Caching.Cache webCache = System.Web.HttpRuntime.Cache;
/// <summary>
/// 默认缓存存活期为3600秒(1小时)
/// </summary>
protected int _timeOut = 3600;
private static object syncObj = new object();
/// <summary>
/// 构造函数
/// </summary>
static DefaultCacheStrategy()
{
//lock (syncObj)
//{
// //System.Web.HttpContext context = System.Web.HttpContext.Current;
// //if(context != null)
// // webCache = context.Cache;
// //else
// webCache = System.Web.HttpRuntime.Cache;
//}
}
/// <summary>
/// 设置到期相对时间[单位: 秒]
/// </summary>
public virtual int TimeOut
{
set { _timeOut = value > 0 ? value : 3600; }
get { return _timeOut > 0 ? _timeOut : 3600; }
}
后面还有 179 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
