技术开发 频道

CS中的缓存类


【IT168技术文档】

/// <summary> /// Summary description for CSCache. /// </summary> public class CSCache { private CSCache(){} //>> Based on Factor = 5 default value public static readonly int DayFactor = TCache.DayFactor; public static readonly int HourFactor = TCache.HourFactor; public static readonly int MinuteFactor = TCache.MinuteFactor; public static readonly double SecondFactor = TCache.SecondFactor; public static void ReSetFactor(int cacheFactor) { TCache.ReSetFactor(cacheFactor); } /**//// <summary> /// Removes all items from the Cache /// </summary> public static void Clear() { TCache.Clear(); } public static void RemoveByPattern(string pattern) { TCache.RemoveByPattern(pattern); } /**//// <summary> /// Removes the specified key from the cache /// </summary> /// <param name="key"></param> public static void Remove(string key) { TCache.Remove(key); } /**//// <summary> /// Insert the current "obj" into the cache. /// </summary> /// <param name="key"></param> /// <param name="obj"></param> public static void Insert(string key, object obj) { TCache.Insert(key, obj, 1); } public static void Insert(string key, object obj, CacheDependency dep) { TCache.Insert(key, obj, dep); } public static void Insert(string key, object obj, int seconds) { TCache.Insert(key, obj, seconds); } public static void Insert(string key, object obj, int seconds, CacheItemPriority priority) { TCache.Insert(key, obj, seconds, priority); } public static void Insert(string key, object obj, CacheDependency dep, int seconds) { TCache.Insert(key, obj, dep, seconds); } public static void Insert(string key, object obj, CacheDependency dep, int seconds, CacheItemPriority priority) { TCache.Insert(key,obj,dep,seconds,priority); } public static void MicroInsert (string key, object obj, int secondFactor) { TCache.MicroInsert(key, obj, secondFactor); } /**//// <summary> /// Insert an item into the cache for the Maximum allowed time /// </summary> /// <param name="key"></param> /// <param name="obj"></param> public static void Max(string key, object obj) { TCache.Max(key, obj); } public static void Max(string key, object obj, CacheDependency dep) { TCache.Max(key, obj, dep); } /**//// <summary> /// Insert an item into the cache for the Maximum allowed time /// </summary> /// <param name="key"></param> /// <param name="obj"></param> public static void Permanent(string key, object obj) { TCache.Permanent(key, obj); } public static void Permanent(string key, object obj, CacheDependency dep) { TCache.Permanent(key, obj, dep); } public static object Get(string key) { return TCache.Get(key); } /**//// <summary> /// Return int of seconds * SecondFactor /// </summary> public static int SecondFactorCalculate(int seconds) { // Insert method below takes integer seconds, so we have to round any fractional values return TCache.SecondFactorCalculate(seconds); } }
0
相关文章