2016-07-08 22:52:40 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
2016-12-27 11:25:51 +08:00
|
|
|
|
namespace Infrastructure.Cache
|
2016-07-08 22:52:40 +08:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2016-11-17 19:48:12 +08:00
|
|
|
|
/// 缓存接口
|
2016-07-08 22:52:40 +08:00
|
|
|
|
/// </summary>
|
2016-12-27 11:25:51 +08:00
|
|
|
|
public abstract class ICacheContext
|
2016-07-08 22:52:40 +08:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取缓存项
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T">缓存对象类型</typeparam>
|
|
|
|
|
/// <param name="key">键</param>
|
|
|
|
|
/// <returns>缓存对象</returns>
|
2016-12-27 11:25:51 +08:00
|
|
|
|
public abstract T Get<T>(string key) ;
|
2016-07-08 22:52:40 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置缓存项
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T">缓存对象类型</typeparam>
|
|
|
|
|
/// <param name="key">键</param>
|
|
|
|
|
/// <param name="t">缓存对象</param>
|
|
|
|
|
/// <returns>true成功,false失败</returns>
|
2016-12-27 11:25:51 +08:00
|
|
|
|
public abstract bool Set<T>(string key, T t, DateTime expire);
|
2016-07-08 22:52:40 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 移除一个缓存项
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="key">缓存项key</param>
|
|
|
|
|
/// <returns>true成功,false失败</returns>
|
|
|
|
|
public abstract bool Remove(string key);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|