54 lines
2.1 KiB
C#
Raw Normal View History

2025-03-17 08:35:19 +08:00
using FreeRedis;
2025-04-15 16:48:35 +08:00
using JiShe.CollectBus.Common.Models;
2025-03-17 08:35:19 +08:00
namespace JiShe.CollectBus.FreeRedisProvider
{
public interface IFreeRedisProvider
{
/// <summary>
/// 获取客户端
/// </summary>
/// <returns></returns>
RedisClient Instance { get; set; }
2025-04-15 16:48:35 +08:00
/// <summary>
/// 单个添加数据
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="redisCacheKey">主数据存储Hash缓存Key</param>
/// <param name="redisCacheFocusIndexKey">集中器索引Set缓存Key</param>
/// <param name="redisCacheScoresIndexKey">集中器排序索引ZSET缓存Key</param>
/// <param name="redisCacheGlobalIndexKey">集中器采集频率分组全局索引ZSet缓存Key</param>
/// <param name="data">表计信息</param>
/// <param name="timestamp">可选时间戳</param>
/// <returns></returns>
Task AddMeterCacheData<T>(
string redisCacheKey,
string redisCacheFocusIndexKey,
string redisCacheScoresIndexKey,
string redisCacheGlobalIndexKey,
T data,
DateTimeOffset? timestamp = null) where T : DeviceCacheBasicModel;
/// <summary>
/// 批量添加数据
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="redisCacheKey">主数据存储Hash缓存Key</param>
/// <param name="redisCacheFocusIndexKey">集中器索引Set缓存Key</param>
/// <param name="redisCacheScoresIndexKey">集中器排序索引ZSET缓存Key</param>
/// <param name="redisCacheGlobalIndexKey">集中器采集频率分组全局索引ZSet缓存Key</param>
/// <param name="items">数据集合</param>
/// <param name="timestamp">可选时间戳</param>
/// <returns></returns>
Task BatchAddMeterData<T>(
string redisCacheKey,
string redisCacheFocusIndexKey,
string redisCacheScoresIndexKey,
string redisCacheGlobalIndexKey,
IEnumerable<T> items,
DateTimeOffset? timestamp = null) where T : DeviceCacheBasicModel;
2025-03-17 08:35:19 +08:00
}
}