

1
public class DataCache
2
{
3
/**//// <summary>
4
/// 获取当前应用程序指定CacheKey的Cache值
5
/// </summary>
6
/// <param name="CacheKey"></param>
7
/// <returns></returns>
8
public static object GetCache(string CacheKey)
9
{
10
System.Web.Caching.Cache objCache = HttpRuntime.Cache;
11
return objCache[CacheKey];
12
}
13
14
/**//// <summary>
15
/// 设置当前应用程序指定CacheKey的Cache值
16
/// </summary>
17
/// <param name="CacheKey"></param>
18
/// <param name="objObject"></param>
19
public static void SetCache(string CacheKey, object objObject)
20
{
21
System.Web.Caching.Cache objCache = HttpRuntime.Cache;
22
objCache.Insert(CacheKey, objObject);
23
}
24
25
/**//// <summary>
26
/// 设置当前应用程序指定CacheKey的Cache值
27
/// </summary>
28
/// <param name="CacheKey"></param>
29
/// <param name="objObject"></param>
30
public static void SetCache(string CacheKey, object objObject, DateTime absoluteExpiration,TimeSpan slidingExpiration )
31
{
32
System.Web.Caching.Cache objCache = HttpRuntime.Cache;
33
objCache.Insert(CacheKey, objObject,null,absoluteExpiration,slidingExpiration);
34
}
35
}

2



3


4

5

6

7

8

9



10

11

12

13

14


15

16

17

18

19

20



21

22

23

24

25


26

27

28

29

30

31



32

33

34

35
