using System;
using System.Collections.Generic;
namespace Learun.Cache.Base
{
///
/// 版 本 PIT-ADMS V7.0.3 敏捷开发框架
/// Copyright (c) 2013-2018 Hexagon PPM
/// 创建人:研发部
/// 日 期:2017.03.06
/// 描 述:定义缓存接口
///
public interface ICache
{
///
/// 查询redis里key的数据,如果没有就执行 dbQuery 里的sql查询,并写入一个新的key
///
///
///
///
///
///
///
///
T GetRedisOrDBData(string cacheKey, string projId, Func dbQuery, TimeSpan? expireTime = null, int dbId = 0);
#region Key-Value
///
/// 读取缓存
///
/// 键
///
T Read(string cacheKey, int dbId = 0) where T : class;
///
/// 写入缓存
///
/// 对象数据
/// 键
void Write(string cacheKey, T value, int dbId = 0) where T : class;
///
/// 写入缓存
///
/// 对象数据
/// 键
/// 到期时间
void Write(string cacheKey, T value, TimeSpan timeSpan, int dbId = 0) where T : class;
///
/// 移除指定数据缓存
///
/// 键
void Remove(string cacheKey, int dbId = 0);
///
/// sws用的
///
///
///
///
void Remove(string cacheKey, string projId, int dbId = 0);
///
/// 移除全部缓存
///
void RemoveAll(int dbId = 0);
#endregion
#region List
#region 同步方法
///
/// 移除指定ListId的内部List的值
///
///
///
void ListRemove(string cacheKey, T value, int dbId = 0) where T : class;
///
/// 获取指定key的List
///
///
///
List ListRange(string cacheKey, int dbId = 0) where T : class;
///
/// 入队
///
///
///
void ListRightPush(string cacheKey, T value, int dbId = 0) where T : class;
///
/// 出队
///
///
///
///
T ListRightPop(string cacheKey, int dbId = 0) where T : class;
///
/// 入栈
///
///
///
///
void ListLeftPush(string cacheKey, T value, int dbId = 0) where T : class;
///
/// 出栈
///
///
///
///
T ListLeftPop(string cacheKey, int dbId = 0) where T : class;
///
/// 获取集合中的数量
///
///
///
long ListLength(string cacheKey, int dbId = 0);
#endregion 同步方法
#endregion List
}
}