Skip to content

Commit e3a3315

Browse files
committed
🎨 refactor(Caching): 重构缓存管理接口并添加新功能
- 重构了 CSRedis 和 FreeRedis 缓存管理类的接口 - 添加了大量新的缓存操作方法,包括同步和异步版本 - 优化了现有方法的实现,提高了性能和可读性 - 移除了不必要的代码和冗余方法 - 更新了相关的测试项目和依赖
1 parent 059d705 commit e3a3315

File tree

48 files changed

+4266
-1170
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+4266
-1170
lines changed

Bing.All.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "02-Logging", "02-Logging",
372372
EndProject
373373
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bing.Logging.Serilog.Tests.Integration", "framework\tests\Bing.Logging.Serilog.Tests.Integration\Bing.Logging.Serilog.Tests.Integration.csproj", "{8A06784C-1C60-C922-5B03-6A47057B5308}"
374374
EndProject
375+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bing.Caching.CSRedis.Tests.Integration", "framework\tests\Bing.Caching.CSRedis.Tests.Integration\Bing.Caching.CSRedis.Tests.Integration.csproj", "{67B838C5-A130-4384-A97C-A858A2A007F2}"
376+
EndProject
375377
Global
376378
GlobalSection(SolutionConfigurationPlatforms) = preSolution
377379
Debug|Any CPU = Debug|Any CPU
@@ -834,6 +836,10 @@ Global
834836
{8A06784C-1C60-C922-5B03-6A47057B5308}.Debug|Any CPU.Build.0 = Debug|Any CPU
835837
{8A06784C-1C60-C922-5B03-6A47057B5308}.Release|Any CPU.ActiveCfg = Release|Any CPU
836838
{8A06784C-1C60-C922-5B03-6A47057B5308}.Release|Any CPU.Build.0 = Release|Any CPU
839+
{67B838C5-A130-4384-A97C-A858A2A007F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
840+
{67B838C5-A130-4384-A97C-A858A2A007F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
841+
{67B838C5-A130-4384-A97C-A858A2A007F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
842+
{67B838C5-A130-4384-A97C-A858A2A007F2}.Release|Any CPU.Build.0 = Release|Any CPU
837843
EndGlobalSection
838844
GlobalSection(SolutionProperties) = preSolution
839845
HideSolutionNode = FALSE
@@ -1003,6 +1009,7 @@ Global
10031009
{F339B49B-E2F8-44CA-AD66-5E6CAA1B6E0F} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
10041010
{59928279-A0DE-4DCB-9032-1BADE8A1E00B} = {5C7976B4-C243-41B9-8303-8E8FAE099D31}
10051011
{8A06784C-1C60-C922-5B03-6A47057B5308} = {59928279-A0DE-4DCB-9032-1BADE8A1E00B}
1012+
{67B838C5-A130-4384-A97C-A858A2A007F2} = {52F64CF7-927F-4D55-A908-9E2239B4E5AB}
10061013
EndGlobalSection
10071014
GlobalSection(ExtensibilityGlobals) = postSolution
10081015
SolutionGuid = {C1202A0F-83CC-4602-BCE5-20CB640BCAD4}

framework/Publish.bat

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,13 @@ dotnet pack src/Bing.Validation -c Release -o nuget_pub
2626
::Security
2727
dotnet pack src/Bing.Security -c Release -o nuget_pub
2828

29-
::Logs
30-
dotnet pack src/Bing.Logs -c Release -o nuget_pub
31-
dotnet pack src/Bing.Logs.Exceptionless -c Release -o nuget_pub
32-
dotnet pack src/Bing.Logs.Log4Net -c Release -o nuget_pub
33-
dotnet pack src/Bing.Logs.NLog -c Release -o nuget_pub
34-
dotnet pack src/Bing.Logs.Serilog -c Release -o nuget_pub
35-
3629
::Logging
3730
dotnet pack src/Bing.Logging -c Release -o nuget_pub
3831
dotnet pack src/Bing.Logging.Serilog -c Release -o nuget_pub
3932
dotnet pack src/Bing.Logging.Sinks.Exceptionless -c Release -o nuget_pub
4033

4134
::Localization
42-
dotnet pack src/Bing.Localization.Abstractions-c Release -o nuget_pub
35+
dotnet pack src/Bing.Localization.Abstractions -c Release -o nuget_pub
4336
dotnet pack src/Bing.Localization -c Release -o nuget_pub
4437

4538
::Data

framework/src/Bing.Aop.AspectCore/Bing.Aop.AspectCore.csproj

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,13 @@
1111
<ProjectReference Include="..\Bing.Core\Bing.Core.csproj" />
1212
</ItemGroup>
1313

14-
<Import Project="dependency.props" />
14+
<PropertyGroup>
15+
<Aspect-RefVersion>2.4.0</Aspect-RefVersion>
16+
</PropertyGroup>
17+
18+
<ItemGroup>
19+
<PackageReference Include="AspectCore.Extensions.AspectScope" Version="$(Aspect-RefVersion)" />
20+
<PackageReference Include="AspectCore.Extensions.Configuration" Version="$(Aspect-RefVersion)" />
21+
<PackageReference Include="AspectCore.Extensions.DependencyInjection" Version="$(Aspect-RefVersion)" />
22+
</ItemGroup>
1523
</Project>

framework/src/Bing.Aop.AspectCore/dependency.props

Lines changed: 0 additions & 11 deletions
This file was deleted.

framework/src/Bing.AspNetCore.Authentication.JwtBearer/Bing.AspNetCore.Authentication.JwtBearer.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
<ItemGroup>
1717
<ProjectReference Include="..\Bing.AspNetCore.Abstractions\Bing.AspNetCore.Abstractions.csproj" />
18+
<ProjectReference Include="..\Bing.Caching\Bing.Caching.csproj" />
1819
</ItemGroup>
1920

2021
<Import Project="..\..\..\common.props" />

framework/src/Bing.AspNetCore.Authentication.JwtBearer/Bing/Identity/JwtBearer/Internal/JsonWebTokenStore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ internal sealed class JsonWebTokenStore : JsonWebTokenStoreBase, IJsonWebTokenSt
2020
public JsonWebTokenStore(ICache cache) => _cache = cache;
2121

2222
/// <inheritdoc />
23-
protected override async Task AddAsync<T>(string key, T value, TimeSpan? expiration = null) => await _cache.AddAsync(key, value, expiration);
23+
protected override async Task AddAsync<T>(string key, T value, TimeSpan? expiration = null) => await _cache.SetAsync(key, value, new CacheOptions { Expiration = expiration });
2424

2525
/// <inheritdoc />
2626
protected override async Task RemoveAsync(string key) => await _cache.RemoveAsync(key);

framework/src/Bing.AspNetCore.Authentication.JwtBearer/Bing/Identity/JwtBearer/Internal/TokenPayloadStore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ internal sealed class TokenPayloadStore : ITokenPayloadStore
2626
/// <param name="payload">负载字典</param>
2727
/// <param name="expires">过期时间</param>
2828
public async Task SaveAsync(string token, IDictionary<string, string> payload, DateTime expires) =>
29-
await _cache.AddAsync(GetPayloadKey(token), payload, expires.Subtract(DateTime.UtcNow));
29+
await _cache.SetAsync(GetPayloadKey(token), payload, new CacheOptions() { Expiration = expires.Subtract(DateTime.UtcNow) });
3030

3131
/// <summary>
3232
/// 移除

framework/src/Bing.Caching.CSRedis/Bing.Caching.CSRedis.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</ItemGroup>
1313

1414
<ItemGroup>
15-
<ProjectReference Include="..\Bing.Core\Bing.Core.csproj" />
15+
<ProjectReference Include="..\Bing.Caching\Bing.Caching.csproj" />
1616
</ItemGroup>
1717

1818
</Project>

framework/src/Bing.Caching.CSRedis/Bing/Caching/CSRedis/CSRedisCacheManager.Async.cs

Lines changed: 0 additions & 120 deletions
This file was deleted.

0 commit comments

Comments
 (0)