CS中的缓存类,保证都看的懂
来源:互联网 发布:et制版软件 编辑:程序博客网 时间:2024/05/22 00:27
什么也不说了,谁都看的懂....
/**//// <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);
}
}
我看这样也行
不过,如果TCache不可以继承的话,而我们又想偷懒的话,以后就不写代码,然后哪别人的代码,然后就像上面这样干...把命名空间改了就好,高效率操作啊:)
/**//// <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);
}
}
我看这样也行
public class CSCache:TCache
{
}
{
}
不过,如果TCache不可以继承的话,而我们又想偷懒的话,以后就不写代码,然后哪别人的代码,然后就像上面这样干...把命名空间改了就好,高效率操作啊:)
- CS中的缓存类,保证都看的懂
- java中的本地缓存【自己构造单例、guava、ehcache:问题:为什么构造缓存、如何构造缓存、如何保证集群内部缓存的一致性】*****很重要
- 从CS的枪械看感情
- 看都看不到的你
- 人人都看得懂的正则表达式教程
- 工程师原创:人人都看得懂的电磁场理论
- 人人都看得懂的电磁场理论
- 人人都看得懂的正则表达式教程
- 人人都看得懂的正则表达式教程
- 正则表达式之人人都看的懂正则
- 人人都看得懂的正则表达式教程
- 人人都看得懂的正则表达式教程
- 人人都看得懂的正则表达式教程
- 人人都看得懂的正则表达式教程
- 程序员的这些笑话,你都看得懂吗?
- 程序员的这些笑话,你都看得懂吗?
- 人人都看得懂的正则表达式
- 人人都看得懂的正则表达式教程
- asp.net控件设计时支持(5)
- asp.net控件设计时支持(4)
- asp.net控件设计时支持(3)
- VTK安装
- [转]强悍!情书居然能写得如此专业
- CS中的缓存类,保证都看的懂
- cs配置文件的获取
- CS控件适配使用
- 关于asp.net服务器控件的一些想法
- linq版本E-Commerce网站示例
- widgets已开源
- Lambda表达式练习
- .net3.5正统分页控件来了(ListView和DataPager)
- Visual Studio Code Name 'Orcas' Express Editions