diff --git a/CoreCms.Net.Caching/AutoMate/RedisCache/IRedisOperationRepository.cs b/CoreCms.Net.Caching/AutoMate/RedisCache/IRedisOperationRepository.cs index 143a2d63..1b586f27 100644 --- a/CoreCms.Net.Caching/AutoMate/RedisCache/IRedisOperationRepository.cs +++ b/CoreCms.Net.Caching/AutoMate/RedisCache/IRedisOperationRepository.cs @@ -131,13 +131,55 @@ namespace CoreCms.Net.Caching.AutoMate.RedisCache Task ListClearAsync(string redisKey); + /// - /// 有序集合/定时任务延迟队列用的多 + /// 有序集合/定时任务延迟队列用的多(直接传分钟) /// /// key /// 元素 /// 分数 Task SortedSetAddAsync(string redisKey, string redisValue, double score); + + /// + /// 有序集合/定时任务延迟队列用的多(直接传时间) + /// + /// key + /// 元素 + /// 时间 + Task SortedSetAddAsync(string redisKey, string redisValue, DateTime dt); + + #region 会员陌小北(QQ:1078350533) 添加的 几个有序集合功能 + + /// + /// 返回有序列表里的数据 + /// + /// RedisKey + /// 0 是第一个 + /// 最大分数值 + /// + Task> SortedSetRangeByRankAsync(string redisKey, int start, int stop); + + /// + /// 移出序列表里的指定范围数量 + /// + /// RedisKey + /// 0 是第一个 + /// 最大分数值 + /// + Task SortedSetRemoveRangeByRankAsync(string redisKey, int start, int stop); + + + /// + /// 返回有序列表里的指定范围数量 + /// + /// RedisKey + /// 0 是第一个 + /// 最大分数值 + /// + Task SortedSetLengthAsync(string redisKey, int start, int stop); + + #endregion + } } diff --git a/CoreCms.Net.Caching/AutoMate/RedisCache/RedisOperationRepository.cs b/CoreCms.Net.Caching/AutoMate/RedisCache/RedisOperationRepository.cs index d70ef80a..42d23b3e 100644 --- a/CoreCms.Net.Caching/AutoMate/RedisCache/RedisOperationRepository.cs +++ b/CoreCms.Net.Caching/AutoMate/RedisCache/RedisOperationRepository.cs @@ -229,7 +229,7 @@ namespace CoreCms.Net.Caching.AutoMate.RedisCache /// - /// 有序集合/定时任务延迟队列用的多 + /// 有序集合/定时任务延迟队列用的多(直接传分钟) /// /// key /// 元素 @@ -239,5 +239,61 @@ namespace CoreCms.Net.Caching.AutoMate.RedisCache await _database.SortedSetAddAsync(redisKey, redisValue, score); } + /// + /// 有序集合/定时任务延迟队列用的多(直接传时间) + /// + /// key + /// 元素 + /// 时间 + public async Task SortedSetAddAsync(string redisKey, string redisValue, DateTime dt) + { + var score = (dt.ToUniversalTime().Ticks - 621355968000000000) / 10000000; + await _database.SortedSetAddAsync(redisKey, redisValue, score); + } + + #region 会员陌小北(QQ:1078350533) 添加的 几个有序集合功能 + + /// + /// 返回有序列表里的数据 + /// + /// RedisKey + /// 0 是第一个 + /// 最大分数值 + /// + public async Task> SortedSetRangeByRankAsync(string redisKey, int start, int stop) + { + var result = await _database.SortedSetRangeByRankAsync(redisKey, start, stop); + + return result.Select(o => o.ToString()); + + } + + /// + /// 移出序列表里的指定范围数量 + /// + /// RedisKey + /// 0 是第一个 + /// 最大分数值 + /// + public async Task SortedSetRemoveRangeByRankAsync(string redisKey, int start, int stop) + { + return await _database.SortedSetRemoveRangeByRankAsync(redisKey, start, stop); + } + + /// + /// 返回有序列表里的指定范围数量 + /// + /// RedisKey + /// 0 是第一个 + /// 最大分数值 + /// + public async Task SortedSetLengthAsync(string redisKey, int start, int stop) + { + return await _database.SortedSetLengthAsync(redisKey, start, stop); + + } + + #endregion 会员陌小北(QQ:1078350533) 添加的 几个有序集合功能 + } }