KingNET.PageLib/Cache/KingNETCache.cs

(开头部分) 16KB

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace KingNET.PageLib.Cache
{
    /// <summary>
    /// 项目缓存基本类
    /// </summary>
    public class KingNETCache
    {
        private static XmlElement objectXmlMap;
        private static ICacheStrategy cs;
        private static volatile KingNETCache instance = null;
        private static object lockHelper = new object();
        private static XmlDocument rootXml = new XmlDocument();
        private static System.Timers.Timer cacheConfigTimer = new System.Timers.Timer(30000);
        /// <summary>
        /// 构造函数
        /// </summary>
        private KingNETCache()
        {
            cs = new DefaultCacheStrategy();

            objectXmlMap = rootXml.CreateElement("Cache");
            //建立内部XML文档.
            rootXml.AppendChild(objectXmlMap);

            cacheConfigTimer.AutoReset = true;
            cacheConfigTimer.Enabled = true;
            cacheConfigTimer.Elapsed += new System.Timers.ElapsedEventHandler(Timer_Elapsed);
            cacheConfigTimer.Start();
        }

        private static void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            //检查并移除相应的缓存项
            instance = CachesFileMonitor.CheckAndRemoveCache(instance);
        }

        public static void CheckAndRemoveCache()
        {
            try
            {
                CachesFileMonitor.cachefilenewchange = DateTime.Now;
                //检查并移除相应的缓存项
                instance = CachesFileMonitor.CheckAndRemoveCache(instance);
            }
            catch
            {

            }
        }
        /// <summary>
        /// 单体模式返回当前类的实例
        /// </summary>
        /// <returns></returns>
        public static KingNETCache GetCacheService()
后面还有 379 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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