Skip to content

Commit

Permalink
Upgrade CSRedisCore version to 3.8.671 (#499)
Browse files Browse the repository at this point in the history
* fix: Upgrade CSRedisCore version to 3.8.671 #496

* test: add Use_Redis6_ACL test
  • Loading branch information
Memoyu authored Oct 12, 2023
1 parent 2fd7fdc commit 8f2c764
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/EasyCaching.CSRedis/EasyCaching.CSRedis.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CSRedisCore" Version="3.6.9" />
<PackageReference Include="CSRedisCore" Version="3.8.671" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\EasyCaching.Core\EasyCaching.Core.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,32 @@ protected override IEasyCachingProvider CreateCachingProvider(Action<BaseProvide
return serviceProvider.GetService<IEasyCachingProvider>();
}

/*[Fact]
public async void Use_Redis6_ACL_Should_Succeed()
{
IServiceCollection services = new ServiceCollection();
services.AddEasyCaching(x =>
x.UseCSRedis(options =>
{
options.DBConfig = new CSRedisDBOptions
{
ConnectionStrings = new System.Collections.Generic.List<string>
{
"127.0.0.1:6388,user=user,password=userpwd,defaultDatabase=13,poolsize=10"
}
};
}).UseCSRedisLock().WithJson(EasyCachingConstValue.DefaultCSRedisName));
IServiceProvider serviceProvider = services.BuildServiceProvider();
var provider = serviceProvider.GetService<IEasyCachingProvider>();
var key = Guid.NewGuid().ToString();
var value = "value";
await provider.SetAsync(key, value, TimeSpan.FromSeconds(20));
var getValue = await provider.GetAsync<string>(key);
Assert.Equal(value, getValue?.Value);
}*/

[Fact]
public void GetDatabase_Should_Succeed()
{
Expand Down Expand Up @@ -148,7 +174,7 @@ public CSRedisCachingProviderWithKeyPrefixTest()
config.SerializerName = "json";

}, "WithKeyPrefix");

x.WithJson("json");
});

Expand Down Expand Up @@ -194,7 +220,7 @@ public void RemoveByPrefixTest()
Assert.False(val3.HasValue);
Assert.False(val4.HasValue);
}

[Theory]
[InlineData("WithKeyPrefix")]
[InlineData("NotKeyPrefix")]
Expand All @@ -219,7 +245,7 @@ public void RemoveByKeyPatternTest(string provider)
var val6 = WithKeyPrefix.Get<string>("sky:birds:bar");
var val7 = WithKeyPrefix.Get<string>("sky:birds:test:bar");
var val8 = WithKeyPrefix.Get<string>("akey");

Assert.True(val1.HasValue);
Assert.True(val2.HasValue);
Assert.True(val3.HasValue);
Expand All @@ -231,15 +257,15 @@ public void RemoveByKeyPatternTest(string provider)

// contains
WithKeyPrefix.RemoveByPattern("*:pots:*");

// postfix
WithKeyPrefix.RemoveByPattern("*foo");

// prefix
WithKeyPrefix.RemoveByPattern("sky*");
WithKeyPrefix.RemoveByPattern("sky*");

// exact
WithKeyPrefix.RemoveByPattern("akey");
WithKeyPrefix.RemoveByPattern("akey");

var val9 = WithKeyPrefix.Get<string>("garden:pots:flowers");
var val10 = WithKeyPrefix.Get<string>("garden:pots:flowers:test");
Expand All @@ -249,7 +275,7 @@ public void RemoveByKeyPatternTest(string provider)
var val14 = WithKeyPrefix.Get<string>("sky:birds:bar");
var val15 = WithKeyPrefix.Get<string>("sky:birds:test:bar");
var val16 = WithKeyPrefix.Get<string>("akey");

Assert.False(val9.HasValue);
Assert.False(val10.HasValue);
Assert.True(val11.HasValue);
Expand All @@ -259,8 +285,8 @@ public void RemoveByKeyPatternTest(string provider)
Assert.False(val15.HasValue);
Assert.False(val16.HasValue);
}
[Theory]

[Theory]
[InlineData("WithKeyPrefix")]
[InlineData("NotKeyPrefix")]
public async Task RemoveByKeyPatternAsyncTest(string provider)
Expand All @@ -284,7 +310,7 @@ public async Task RemoveByKeyPatternAsyncTest(string provider)
var val6 = WithKeyPrefix.Get<string>("sky:birds:bar");
var val7 = WithKeyPrefix.Get<string>("sky:birds:test:bar");
var val8 = WithKeyPrefix.Get<string>("akey");

Assert.True(val1.HasValue);
Assert.True(val2.HasValue);
Assert.True(val3.HasValue);
Expand All @@ -296,15 +322,15 @@ public async Task RemoveByKeyPatternAsyncTest(string provider)

// contains
await WithKeyPrefix.RemoveByPatternAsync("*:pots:*");

// postfix
await WithKeyPrefix.RemoveByPatternAsync("*foo");

// prefix
await WithKeyPrefix.RemoveByPatternAsync("sky*");
await WithKeyPrefix.RemoveByPatternAsync("sky*");

// exact
await WithKeyPrefix.RemoveByPatternAsync("akey");
await WithKeyPrefix.RemoveByPatternAsync("akey");

var val9 = WithKeyPrefix.Get<string>("garden:pots:flowers");
var val10 = WithKeyPrefix.Get<string>("garden:pots:flowers:test");
Expand All @@ -314,7 +340,7 @@ public async Task RemoveByKeyPatternAsyncTest(string provider)
var val14 = WithKeyPrefix.Get<string>("sky:birds:bar");
var val15 = WithKeyPrefix.Get<string>("sky:birds:test:bar");
var val16 = WithKeyPrefix.Get<string>("akey");

Assert.False(val9.HasValue);
Assert.False(val10.HasValue);
Assert.True(val11.HasValue);
Expand Down

0 comments on commit 8f2c764

Please sign in to comment.