App_Code/CacheManage.cs
(完整代码) 1KBusing System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Web.Caching;
/// <summary>
/// CacheManage 的摘要说明
/// </summary>
public class CacheManage
{
static DateTime exp = DateTime.Now.AddMinutes(30);
public CacheManage()
{
}
public static object GetCache(string key)
{
if (HttpContext.Current.Cache[key] == null)
return null;
else
return HttpContext.Current.Cache.Get(key);
}
public static void SetCache(string key, object value)
{
if (HttpContext.Current.Cache[key] == null)
//HttpContext.Current.Cache.Insert(key, value, null, System.Web.Caching.Cache.NoAbsoluteExpiration, exp);
HttpContext.Current.Cache.Insert(key, value, null, exp, System.Web.Caching.Cache.NoSlidingExpiration);
else
HttpContext.Current.Cache[key] = value;
}
public static void RemoveCache(string key)
{
if (HttpContext.Current.Cache[key] != null)
HttpContext.Current.Cache.Remove(key);
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
