Skip to content

Commit 493b3e6

Browse files
committed
更新 GetAllByPrefixAsync(key) 方法
1 parent d02f854 commit 493b3e6

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/Senparc.CO2NET.Cache.CsRedis/ObjectCacheStrategy/RedisObjectCacheStrategy.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ public override async Task UpdateAsync(string key, object value, TimeSpan? expir
376376
/// </summary>
377377
public IList<T> GetAllByPrefix<T>(string key)
378378
{
379-
var keyPattern = GetFinalKey(key);//获取带Senparc:DefaultCache:前缀的Key([DefaultCache]
379+
var keyPattern = GetFinalKey(key + "*");//获取带Senparc:DefaultCache:前缀的Key([DefaultCache]
380380
var keys = base.Client.Keys(/*database: Client.GetDatabase().Database,*/ pattern: keyPattern/*, pageSize: 99999*/);
381381
List<T> list = new List<T>();
382382
foreach (var fullKey in keys)
@@ -397,7 +397,7 @@ public IList<T> GetAllByPrefix<T>(string key)
397397
/// </summary>
398398
public async Task<IList<T>> GetAllByPrefixAsync<T>(string key)
399399
{
400-
var keyPattern = GetFinalKey(key);//获取带Senparc:DefaultCache:前缀的Key([DefaultCache]
400+
var keyPattern = GetFinalKey(key + "*");//获取带Senparc:DefaultCache:前缀的Key([DefaultCache]
401401
var keys = base.Client.Keys(/*database: Client.GetDatabase().Database,*/ pattern: keyPattern/*, pageSize: 99999*/);
402402
List<T> list = new List<T>();
403403
foreach (var fullKey in keys)

src/Senparc.CO2NET.Cache.CsRedis/Senparc.CO2NET.Cache.CsRedis.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
4-
<Version>1.2.5</Version>
4+
<Version>1.2.5.1</Version>
55
<AssemblyName>Senparc.CO2NET.Cache.CsRedis</AssemblyName>
66
<RootNamespace>Senparc.CO2NET.Cache.CsRedis</RootNamespace>
77
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>

src/Senparc.CO2NET.Cache.Redis/ObjectCacheStrategy/RedisObjectCacheStrategy.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ public override async Task UpdateAsync(string key, object value, TimeSpan? expir
373373
/// </summary>
374374
public IList<T> GetAllByPrefix<T>(string key)
375375
{
376-
var keyPattern = GetFinalKey(key);//获取带Senparc:DefaultCache:前缀的Key([DefaultCache]
376+
var keyPattern = GetFinalKey(key + "*");//获取带Senparc:DefaultCache:前缀的Key([DefaultCache]
377377
var keys = GetServer().Keys(database: Client.GetDatabase().Database, pattern: keyPattern, pageSize: 99999);
378378
List<T> list = new List<T>();
379379
foreach (var fullKey in keys)
@@ -394,7 +394,7 @@ public IList<T> GetAllByPrefix<T>(string key)
394394
/// </summary>
395395
public async Task<IList<T>> GetAllByPrefixAsync<T>(string key)
396396
{
397-
var keyPattern = GetFinalKey(key);//获取带Senparc:DefaultCache:前缀的Key([DefaultCache]
397+
var keyPattern = GetFinalKey(key + "*");//获取带Senparc:DefaultCache:前缀的Key([DefaultCache]
398398
var keys = GetServer().Keys(database: Client.GetDatabase().Database, pattern: keyPattern, pageSize: 99999);
399399
List<T> list = new List<T>();
400400
foreach (var fullKey in keys)

src/Senparc.CO2NET.Cache.Redis/Senparc.CO2NET.Cache.Redis.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
4-
<Version>4.2.5</Version>
4+
<Version>4.2.5.1</Version>
55
<AssemblyName>Senparc.CO2NET.Cache.Redis</AssemblyName>
66
<RootNamespace>Senparc.CO2NET.Cache.Redis</RootNamespace>
77
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>

0 commit comments

Comments
 (0)