AllPower.COMMON/AppCache.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Web;
using System.Web.Caching;
using System.Configuration;
#region 版权注释
/*================================================================
Copyright (C) 2010 华强北在线
作者: 陈顺
创建时间: 2010年4月23日
功能描述: 系统缓存类
===============================================================*/
#endregion
namespace AllPower.Common
{
public class AppCache
{
public static Cache _cache = HttpContext.Current.Cache;
private AppCache() { }
public static bool IsExist(string key)
{
_cache = HttpContext.Current.Cache;
if (_cache[key] != null)
{
return true;
}
else
{
return false;
}
}
public static void Add(string key, object obj)
{
_cache.Add(key, obj, null, Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, CacheItemPriority.High, null);
}
public static void Add(string key, object obj, string file)
{
//允许表指定缓存依赖项
SqlCacheDependencyAdmin.EnableTableForNotifications(ConfigurationManager.ConnectionStrings["SQLConnString1"].ConnectionString, file);
_cache.Add(key, obj, new SqlCacheDependency("HQB",file), Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, CacheItemPriority.High, null);
}
public static void Remove(string key)
{
_cache.Remove(key);
}
public static object Get(string key)
{
return _cache[key];
}
/// <summary>
后面还有 11 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
