using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MyCode.Project.Infrastructure.Cache { public interface IMyCodeCacheService { /// /// 根据key得到缓存值 /// /// 缓存key /// object Get(string key); /// /// 根据缓存Key返回一个具体的对象 /// /// /// /// T Get(string key); /// /// 设置缓存 /// /// 缓存Key /// 缓存对象 /// 过期时间 void Set(string key, object cache_object, TimeSpan? expiration = null); /// /// 设置缓存有效时长(仅redis缓存有用,系统缓存无执行效果) /// /// /// void KeyExpire(string key, TimeSpan? expiry); /// /// 根据key删除一个缓存 /// /// void Delete(string key); /// /// 判断是否存在缓存 /// /// /// bool Exists(string key); /// /// 放入队列 /// /// /// /// 有效时间 void Push(string key, object data, TimeSpan? timeSpan = null); /// /// 放入队列 /// /// /// void Push(string key, object data ); /// /// Popup(获取第一条数据,并删除) /// /// /// object Popup(string key); /// /// 自增1,返回自增后的值 /// /// /// long Incr(string key); /// /// 递减1,返回递减后的值 /// /// /// long Decr(string key); /// /// 设置一个整型缓存 /// /// /// void SetIncr(string key, int value); } }