using System; namespace Infrastructure.Cache { /// /// 策略模式缓存组件,可实现动态插拔 /// public abstract class CacheContext : IDisposable { /// /// 初始化缓存组件 /// public abstract void Init(); /// /// 获取缓存项 /// /// 缓存对象类型 /// 键 /// 缓存对象 public abstract T Get(string key) where T : class; /// /// 设置缓存项 /// /// 缓存对象类型 /// 键 /// 缓存对象 /// true成功,false失败 public abstract bool Set(string key, T t) where T : class; /// /// 移除一个缓存项 /// /// 缓存项key /// true成功,false失败 public abstract bool Remove(string key); /// /// 释放缓存组件 /// public abstract void Dispose(); } }