VideoHome.Cache/DefaultCacheStrategy.cs

(开头部分) 7KB

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

using System;
using System.Web;
using System.Collections;
using System.Web.Caching;

namespace myfilm.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
	{
		private static readonly DefaultCacheStrategy instance = new DefaultCacheStrategy();

        protected static volatile System.Web.Caching.Cache webCache = System.Web.HttpRuntime.Cache;

        protected int _timeOut = 1440; // 默认缓存存活期为1440分钟(24小时)

		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 int TimeOut
		{
			set { _timeOut = value > 0 ? value : 6000; }
			get { return _timeOut > 0 ? _timeOut : 6000; }
		}
后面还有 183 行代码,购买后查看完整代码

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

AI 解读 AI

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

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