From 36031b91aa53633662255d72d218d6bf5c358c0e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=AB=A5=E6=AF=93=E6=B3=BD?= <13204402429@stu.ecnu.edu.cn>
Date: Sun, 17 Jan 2021 21:39:31 +0800
Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=20'CacheHelper.cs'?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
CacheHelper.cs | 66 ----------------------------------------------------------
1 file changed, 66 deletions(-)
delete mode 100644 CacheHelper.cs
diff --git a/CacheHelper.cs b/CacheHelper.cs
deleted file mode 100644
index c67d2b2..0000000
--- a/CacheHelper.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Web;
-using System.Web.Caching;
-
-///
-///CacheHelper 的摘要说明
-///
-///
-namespace Basic
-{
- public class CacheHelper
- {
- ///
- /// 创建缓存项的文件依赖
- ///
- /// 缓存Key
- /// object对象
- /// 文件绝对路径
- public static void Insert(string key, object obj, string fileName)
- {
- //创建缓存依赖项
- CacheDependency dep = new CacheDependency(fileName);
- //创建缓存
- HttpContext.Current.Cache.Insert(key, obj, dep);
- }
-
- ///
- /// 创建缓存项过期
- ///
- /// 缓存Key
- /// object对象
- /// 过期时间(分钟)
- public static void Insert(string key, object obj, int expires)
- {
- HttpContext.Current.Cache.Insert(key, obj, null, Cache.NoAbsoluteExpiration, new TimeSpan(0, expires, 0));
- }
-
- ///
- /// 获取缓存对象
- ///
- /// 缓存Key
- /// object对象
- public static object Get(string key)
- {
- if (string.IsNullOrEmpty(key))
- {
- return null;
- }
- return HttpContext.Current.Cache.Get(key);
- }
-
- ///
- /// 获取缓存对象
- ///
- /// T对象
- /// 缓存Key
- ///
- public static T Get(string key)
- {
- object obj = Get(key);
- return obj == null ? default(T) : (T)obj;
- }
- }
-}
\ No newline at end of file