C# memcached缓存使用实例代码
public interface icachestrategy
{
/// <summary>
/// 添加数据到缓存
/// </summary>
/// <param name="objid">缓存名称</param>
/// <param name="o">缓存内容</param>
/// <param name="second">缓存时间(秒)</param>
void add(string objid, object o, int second);
/// <summary>
/// 添加数据到缓存 (依赖其它缓存)
/// </summary>
/// <param name="objid">缓存名称</param>
/// <param name="o">缓存内容</param>
/// <param name="second">缓存时间(秒)</param>
/// <param name="dependkey">依赖缓存名称数组</param>
void addcachedepend(string objid, object o, int second, string[] dependkey);
/// <summary>
/// 添加数据到缓存 (依赖文件)
/// </summary>
/// <param name="objid">缓存名称</param>
/// <param name="o">缓存内容</param>
/// <param name="second">缓存时间(秒)</param>
/// <param name="files">依赖缓存名称文件名数组</param>
void addfiledepend(string objid, object o, int second, string[] files);
/// <summary>
/// 删除指定缓存
/// </summary>
/// <param name="objid"></param>
void removecache(string objid);
/// <summary>
/// 删除所有缓存
/// </summary>
void removecacheall();
/// <summary>
/// 删除匹配到的缓存
/// </summary>
/// <param name="pattern"></param>
/// <returns></returns>
void removecacheregex(string pattern);
/// <summary>
/// 获取所有缓存键
/// </summary>
/// <returns></returns>
ilist<string> getcachekeys();
/// <summary>
/// 搜索 匹配到的缓存
/// </summary>
/// <param name="pattern"></param>
/// <returns></returns>
ilist<string> searchcacheregex(string pattern);
/// <summary>
/// 获得缓存数据
/// </summary>
/// <param name="objid"></param>
/// <returns></returns>
object getcachedata(string objid);
/// <summary>
/// 判断此缓存是否有效
/// </summary>
/// <param name="objid"></param>
/// <returns></returns>
bool hascache(string objid);
}
上一篇: 在.NET Core控制台程序中如何使用依赖注入详解
下一篇: Android亮屏和熄屏控制实例详解