Common/DoCache.cs

(开头部分) 2KB

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

using System;
using System.Collections.Generic;
using System.Text;
using System.Web.Caching;
using System.Web;
 
/// <summary>
/// 缓存数据
/// </summary>
  public  class DoCache
    {
      /// <summary>
      /// 将对象放入缓存
      /// </summary>
      /// <param name="cachekey"></param>
      /// <param name="obj"></param>
      public static void AddCache(string cachekey, object obj)
      {

          if (Global_Upload.UseCache)
          {
              if (obj != null)
              {
                  Cache c = HttpRuntime.Cache;
                  c.Insert(cachekey, obj, null, DateTime.Now.AddMinutes(ConfigHelper.GetConfigInt("CacheTime")), Cache.NoSlidingExpiration);

              }
          }
      }

      /// <summary>
      /// 返回缓存数据 
      /// </summary>
      /// <param name="cachekey"></param>
      /// <returns></returns>
      public static object GetCache(string cachekey)
      {
          if (Global_Upload.UseCache)
          {
              Cache c = HttpRuntime.Cache;

              if (c[cachekey] != null)
                  return c[cachekey];
              return null;
          }
          else
              return null;
        

      }


      /// <summary>
      /// 将对象放入缓存(加入文件)
      /// </summary>
      /// <param name="cachekey"></param>
      /// <param name="obj"></param>
      public static void AddCacheChangeInfo(string cachekey, object obj)
      {
          string filename = HttpContext.Current.Server.MapPath("~/cache/changeinfo/index.txt");
后面还有 23 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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