using FreeRedis;
using JiShe.CollectBus.Common.Models;
namespace JiShe.CollectBus.FreeRedisProvider
{
public interface IFreeRedisProvider
{
///
/// 获取客户端
///
///
RedisClient Instance { get; set; }
///
/// 单个添加数据
///
///
/// 主数据存储Hash缓存Key
/// 集中器索引Set缓存Key
/// 集中器排序索引ZSET缓存Key
/// 集中器采集频率分组全局索引ZSet缓存Key
/// 表计信息
/// 可选时间戳
///
Task AddMeterCacheData(
string redisCacheKey,
string redisCacheFocusIndexKey,
string redisCacheScoresIndexKey,
string redisCacheGlobalIndexKey,
T data,
DateTimeOffset? timestamp = null) where T : DeviceCacheBasicModel;
///
/// 批量添加数据
///
///
/// 主数据存储Hash缓存Key
/// 集中器索引Set缓存Key
/// 集中器排序索引ZSET缓存Key
/// 集中器采集频率分组全局索引ZSet缓存Key
/// 数据集合
/// 可选时间戳
///
Task BatchAddMeterData(
string redisCacheKey,
string redisCacheFocusIndexKey,
string redisCacheScoresIndexKey,
string redisCacheGlobalIndexKey,
IEnumerable items,
DateTimeOffset? timestamp = null) where T : DeviceCacheBasicModel;
///
/// 删除指定redis缓存key的缓存数据
///
///
/// 主数据存储Hash缓存Key
/// 集中器索引Set缓存Key
/// 集中器排序索引ZSET缓存Key
/// 集中器采集频率分组全局索引ZSet缓存Key
/// 表计信息
///
Task RemoveMeterData(
string redisCacheKey,
string redisCacheFocusIndexKey,
string redisCacheScoresIndexKey,
string redisCacheGlobalIndexKey,
T data) where T : DeviceCacheBasicModel;
///
/// 修改表计缓存信息
///
///
/// 主数据存储Hash缓存Key
/// 旧集中器索引Set缓存Key
/// 新集中器索引Set缓存Key
/// 集中器排序索引ZSET缓存Key
/// 集中器采集频率分组全局索引ZSet缓存Key
/// 表计信息
/// 可选时间戳
///
Task UpdateMeterData(
string redisCacheKey,
string oldRedisCacheFocusIndexKey,
string newRedisCacheFocusIndexKey,
string redisCacheScoresIndexKey,
string redisCacheGlobalIndexKey,
T newData,
DateTimeOffset? newTimestamp = null) where T : DeviceCacheBasicModel;
///
/// 通过全局索引分页查询表计缓存数据
///
///
/// 主数据存储Hash缓存Key
/// 集中器采集频率分组全局索引ZSet缓存Key
/// 分页尺寸
/// 最后一个索引
/// 最后一个唯一标识
/// 排序方式
///
Task> GetGlobalPagedData(
string redisCacheKey,
string redisCacheGlobalIndexKey,
int pageSize = 10,
decimal? lastScore = null,
string lastMember = null,
bool descending = true)
where T : DeviceCacheBasicModel;
}
}