Hidistro.Core/HiCache.cs

(开头部分) 3KB

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

namespace Hidistro.Core
{
    using System;
    using System.Collections;
    using System.Text.RegularExpressions;
    using System.Web;
    using System.Web.Caching;

    public sealed class HiCache
    {
        private static Cache _cache;
        public const int DayFactor = 0x4380;
        private static int Factor = 5;
        public const int HourFactor = 720;
        public const int MinuteFactor = 12;
        public const double SecondFactor = 0.2;

        static HiCache()
        {
            HttpContext current = HttpContext.Current;
            if (current != null)
            {
                _cache = current.Cache;
            }
            else
            {
                _cache = HttpRuntime.Cache;
            }
        }

        private HiCache()
        {
        }

        public static void Clear()
        {
            IDictionaryEnumerator enumerator = _cache.GetEnumerator();
            ArrayList list = new ArrayList();
            while (enumerator.MoveNext())
            {
                list.Add(enumerator.Key);
            }
            foreach (string str in list)
            {
                _cache.Remove(str);
            }
        }

        public static object Get(string key)
        {
            return _cache[key];
        }

        public static void Insert(string key, object obj)
        {
            Insert(key, obj, null, 1);
        }

        public static void Insert(string key, object obj, int seconds)
        {
后面还有 77 行代码,购买后查看完整代码

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

AI 解读 AI

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

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