48 lines
1.2 KiB
C#
48 lines
1.2 KiB
C#
|
|
using System;
|
|||
|
|
using System.Web;
|
|||
|
|
|
|||
|
|
namespace ZWL.Common
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>صIJ<D8B5><C4B2><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// <20><>Ϊ<EFBFBD><CEAA>
|
|||
|
|
/// 2008.4.1
|
|||
|
|
/// </summary>
|
|||
|
|
public class DataCache
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>ȡ<EFBFBD><C8A1>ǰӦ<C7B0>ó<EFBFBD><C3B3><EFBFBD>ָ<EFBFBD><D6B8>CacheKey<65><79>Cacheֵ
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="CacheKey"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public static object GetCache(string CacheKey)
|
|||
|
|
{
|
|||
|
|
System.Web.Caching.Cache objCache = HttpRuntime.Cache;
|
|||
|
|
return objCache[CacheKey];
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD>õ<EFBFBD>ǰӦ<C7B0>ó<EFBFBD><C3B3><EFBFBD>ָ<EFBFBD><D6B8>CacheKey<65><79>Cacheֵ
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="CacheKey"></param>
|
|||
|
|
/// <param name="objObject"></param>
|
|||
|
|
public static void SetCache(string CacheKey, object objObject)
|
|||
|
|
{
|
|||
|
|
System.Web.Caching.Cache objCache = HttpRuntime.Cache;
|
|||
|
|
objCache.Insert(CacheKey, objObject);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD>õ<EFBFBD>ǰӦ<C7B0>ó<EFBFBD><C3B3><EFBFBD>ָ<EFBFBD><D6B8>CacheKey<65><79>Cacheֵ
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="CacheKey"></param>
|
|||
|
|
/// <param name="objObject"></param>
|
|||
|
|
public static void SetCache(string CacheKey, object objObject, DateTime absoluteExpiration,TimeSpan slidingExpiration )
|
|||
|
|
{
|
|||
|
|
System.Web.Caching.Cache objCache = HttpRuntime.Cache;
|
|||
|
|
objCache.Insert(CacheKey, objObject,null,absoluteExpiration,slidingExpiration);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|