Skip to content

Commit c01a3ea

Browse files
committed
chore: net10
1 parent 800d718 commit c01a3ea

28 files changed

+329
-220
lines changed

.devcontainer/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
devcontainer:
3-
image: mcr.microsoft.com/devcontainers/dotnet:9.0-bookworm
3+
image: mcr.microsoft.com/devcontainers/dotnet:dev-10.0
44
volumes:
55
- ..:/workspace:cached
66
command: sleep infinity

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ dotnet_diagnostic.IDE0301.severity = warning
1818
dotnet_diagnostic.IDE0303.severity = warning
1919
dotnet_diagnostic.IDE0305.severity = warning
2020

21+
dotnet_diagnostic.MSTEST0016.severity = warning
22+
dotnet_diagnostic.MSTEST0049.severity = warning
23+
2124
csharp_space_between_square_brackets = true
2225
csharp_style_var_elsewhere = true:warning
2326
csharp_style_var_for_built_in_types = true:warning

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Setup
2525
uses: actions/setup-dotnet@v4
2626
with:
27-
dotnet-version: 9
27+
dotnet-version: 10
2828
- name: Pack
2929
run: dotnet pack -c Release
3030
- name: Publish

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"type": "coreclr",
88
"request": "launch",
99
"preLaunchTask": "build",
10-
"program": "${workspaceFolder}/labs/MessagingRedisCache/bin/Debug/net9.0/MessagingRedisCache.Lab.dll",
10+
"program": "${workspaceFolder}/labs/MessagingRedisCache/bin/Debug/net10.0/MessagingRedisCache.Lab.dll",
1111
"args": [],
1212
"cwd": "${workspaceFolder}/labs/MessagingRedisCache",
1313
"stopAtEntry": false,

Directory.Packages.props

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,25 @@
44
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
55
</PropertyGroup>
66
<ItemGroup>
7-
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
8-
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
9-
<PackageVersion Include="Microsoft.Extensions.Caching.Abstractions" Version="9.0.0" />
10-
<PackageVersion Include="Microsoft.Extensions.Caching.Hybrid" Version="9.0.0-preview.9.24556.5" />
11-
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="9.0.0" />
12-
<PackageVersion Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="9.0.0" />
13-
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.0" />
14-
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0" />
15-
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="9.0.0" />
16-
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
17-
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
18-
<PackageVersion Include="MSTest.TestAdapter" Version="3.6.4" />
19-
<PackageVersion Include="MSTest.TestFramework" Version="3.6.4" />
7+
<PackageVersion Include="BenchmarkDotNet" Version="0.15.6" />
8+
<PackageVersion Include="Microsoft.Extensions.Caching.Abstractions" Version="10.0.0" />
9+
<PackageVersion Include="Microsoft.Extensions.Caching.Hybrid" Version="10.0.0" />
10+
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="10.0.0" />
11+
<PackageVersion Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="10.0.0" />
12+
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.0" />
13+
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="10.0.0" />
14+
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="10.0.0" />
15+
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
16+
<PackageVersion Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.1.0" />
17+
<PackageVersion Include="Microsoft.Testing.Extensions.CrashDump" Version="2.0.2" />
18+
<PackageVersion Include="Microsoft.Testing.Extensions.HangDump" Version="2.0.2" />
19+
<PackageVersion Include="Microsoft.Testing.Extensions.Retry" Version="2.0.2" />
20+
<PackageVersion Include="Microsoft.Testing.Extensions.Telemetry" Version="2.0.2" />
21+
<PackageVersion Include="Microsoft.Testing.Extensions.TrxReport" Version="2.0.2" />
22+
<PackageVersion Include="Microsoft.Testing.Platform" Version="2.0.2" />
23+
<PackageVersion Include="Microsoft.Testing.Platform.MSBuild" Version="2.0.2" />
24+
<PackageVersion Include="MSTest.TestAdapter" Version="4.0.2" />
25+
<PackageVersion Include="MSTest.TestFramework" Version="4.0.2" />
2026
<PackageVersion Include="NSubstitute" Version="5.3.0" />
2127
</ItemGroup>
2228
</Project>

global.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"test":
3+
{
4+
"runner": "Microsoft.Testing.Platform"
5+
}
6+
}

labs/MessagingRedisCache/MessagingRedisCache.Lab.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<NoWarn>EXTEXP0018;</NoWarn>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net9.0</TargetFramework>
5+
<TargetFramework>net10.0</TargetFramework>
66
</PropertyGroup>
77
<ItemGroup>
88
<ProjectReference Include="..\..\src\MessagingRedisCache\MessagingRedisCache.csproj" />

src/L1L2RedisCache/Configuration/ServiceCollectionExtensions.cs

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,25 @@ namespace Microsoft.Extensions.DependencyInjection;
88
/// </summary>
99
public static class ServiceCollectionExtensions
1010
{
11-
/// <summary>
12-
/// Adds L1L2RedisCache distributed caching services to the specified <c>IServiceCollection</c>.
13-
/// </summary>
14-
/// <returns>The <c>IServiceCollection</c> so that additional calls can be chained.</returns>
15-
public static IServiceCollection AddL1L2RedisCache(
16-
this IServiceCollection services,
17-
Action<MessagingRedisCacheOptions> setupAction)
11+
extension(
12+
IServiceCollection services)
1813
{
19-
ArgumentNullException.ThrowIfNull(setupAction);
14+
/// <summary>
15+
/// Adds L1L2RedisCache distributed caching services to the specified <c>IServiceCollection</c>.
16+
/// </summary>
17+
/// <returns>The <c>IServiceCollection</c> so that additional calls can be chained.</returns>
18+
public IServiceCollection AddL1L2RedisCache(
19+
Action<MessagingRedisCacheOptions> setupAction)
20+
{
21+
ArgumentNullException.ThrowIfNull(setupAction);
2022

21-
services
22-
.AddMessagingRedisCache(setupAction)
23-
.AddMemoryCacheSubscriber();
24-
services.AddSingleton<IDistributedCache, L1L2RedisCache.L1L2RedisCache>();
25-
services.AddMemoryCache();
23+
services
24+
.AddMessagingRedisCache(setupAction)
25+
.AddMemoryCacheSubscriber();
26+
services.AddSingleton<IDistributedCache, L1L2RedisCache.L1L2RedisCache>();
27+
services.AddMemoryCache();
2628

27-
return services;
29+
return services;
30+
}
2831
}
2932
}

src/L1L2RedisCache/HashEntryArrayExtensions.cs

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,40 @@ internal static class HashEntryArrayExtensions
1010
private const long NotPresent = -1;
1111
private const string SlidingExpirationKey = "sldexp";
1212

13-
internal static DistributedCacheEntryOptions GetDistributedCacheEntryOptions(
14-
this HashEntry[] hashEntries)
13+
extension(
14+
HashEntry[] hashEntries)
1515
{
16-
var distributedCacheEntryOptions = new DistributedCacheEntryOptions();
17-
18-
var absoluteExpirationHashEntry = hashEntries.FirstOrDefault(
19-
hashEntry => hashEntry.Name == AbsoluteExpirationKey);
20-
if (absoluteExpirationHashEntry.Value.HasValue &&
21-
absoluteExpirationHashEntry.Value != NotPresent)
16+
internal DistributedCacheEntryOptions GetDistributedCacheEntryOptions()
2217
{
23-
distributedCacheEntryOptions.AbsoluteExpiration = new DateTimeOffset(
24-
(long)absoluteExpirationHashEntry.Value, TimeSpan.Zero);
18+
var distributedCacheEntryOptions = new DistributedCacheEntryOptions();
19+
20+
var absoluteExpirationHashEntry = hashEntries.FirstOrDefault(
21+
hashEntry => hashEntry.Name == AbsoluteExpirationKey);
22+
if (absoluteExpirationHashEntry.Value.HasValue &&
23+
absoluteExpirationHashEntry.Value != NotPresent)
24+
{
25+
distributedCacheEntryOptions.AbsoluteExpiration = new DateTimeOffset(
26+
(long)absoluteExpirationHashEntry.Value, TimeSpan.Zero);
27+
}
28+
29+
var slidingExpirationHashEntry = hashEntries.FirstOrDefault(
30+
hashEntry => hashEntry.Name == SlidingExpirationKey);
31+
if (slidingExpirationHashEntry.Value.HasValue &&
32+
slidingExpirationHashEntry.Value != NotPresent)
33+
{
34+
distributedCacheEntryOptions.SlidingExpiration = new TimeSpan(
35+
(long)slidingExpirationHashEntry.Value);
36+
}
37+
38+
return distributedCacheEntryOptions;
2539
}
2640

27-
var slidingExpirationHashEntry = hashEntries.FirstOrDefault(
28-
hashEntry => hashEntry.Name == SlidingExpirationKey);
29-
if (slidingExpirationHashEntry.Value.HasValue &&
30-
slidingExpirationHashEntry.Value != NotPresent)
41+
internal RedisValue GetRedisValue()
3142
{
32-
distributedCacheEntryOptions.SlidingExpiration = new TimeSpan(
33-
(long)slidingExpirationHashEntry.Value);
34-
}
35-
36-
return distributedCacheEntryOptions;
37-
}
43+
var dataHashEntry = hashEntries.FirstOrDefault(
44+
hashEntry => hashEntry.Name == DataKey);
3845

39-
internal static RedisValue GetRedisValue(
40-
this HashEntry[] hashEntries)
41-
{
42-
var dataHashEntry = hashEntries.FirstOrDefault(
43-
hashEntry => hashEntry.Name == DataKey);
44-
45-
return dataHashEntry.Value;
46+
return dataHashEntry.Value;
47+
}
4648
}
4749
}

0 commit comments

Comments
 (0)