Discuz.Forum/ForumCacheStrategy.cs

(开头部分) 6KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Web.Caching;

using Discuz.Common;
using Discuz.Data;

namespace Discuz.Forum
{
	/// <summary>
	/// ForumCacheStrategy 缓存
	/// 定制的论坛缓存策略类, 以实现到期时间设置和其它设置
	/// </summary>
    //public class ForumCacheStrategy : Discuz.Cache.ICacheStrategy
    //{
    //    protected static volatile System.Web.Caching.Cache webCacheforfocus = null;

    //    private int _timeOut = 1200; // 默认缓存存活期为20分钟

    //    /// <summary>
    //    /// 构造函数
    //    /// </summary>
    //    static ForumCacheStrategy()
    //    {
    //        webCacheforfocus = Discuz.Cache.DefaultCacheStrategy.GetWebCacheObj;
    //    }		
		
    //    /// <summary>
    //    /// 设置到期相对时间[单位:秒]
    //    /// </summary>
    //    virtual public int TimeOut
    //    {
    //        set { _timeOut = (value < 1200) ? value : 1200; }
    //        get { return (_timeOut < 1200) ? _timeOut : 1200; }
    //    }
		
    //    /// <summary>
    //    /// 加入当前对象到缓存中
    //    /// </summary>
    //    /// <param name="objId">key for the object</param>
    //    /// <param name="o">object</param>
    //    public void AddObject(string objId, object o)
    //    {		
    //        if (objId == null || objId.Length == 0 || o == null) 
    //            return;

    //        CacheItemRemovedCallback callBack = new CacheItemRemovedCallback(onRemove);
    //        webCacheforfocus.Insert(objId, o, null, DateTime.Now.AddSeconds(TimeOut), System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.High, callBack);
    //    }

    //    /// <summary>
    //    /// 加入当前对象到缓存中
    //    /// </summary>
    //    /// <param name="objId">对象的键值</param>
    //    /// <param name="o">缓存的对象</param>
    //    /// <param name="o">到期时间,单位:秒</param>
    //    public virtual void AddObject(string objId, object o, int expire)
    //    {
    //        if (objId == null || objId.Length == 0 || o == null)
    //            return;

后面还有 120 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。