Skip to content

Commit

Permalink
Merge pull request #240 from cnblogs/update-packages
Browse files Browse the repository at this point in the history
chore: support .net 9.0 and update packages
  • Loading branch information
cnblogs-dudu authored Nov 23, 2024
2 parents 72a8038 + 0c18085 commit 5afe0c6
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 74 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ on:
jobs:
test:
runs-on: ubuntu-latest
container: mcr.microsoft.com/dotnet/sdk:8.0
container: mcr.microsoft.com/dotnet/sdk:9.0

services:
memcached:
image: memcached
image: memcached:1.5.8

steps:
- name: Checkout
Expand Down
4 changes: 2 additions & 2 deletions sample/SampleWebApp/SampleWebApp.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>Enyim.Caching.SampleWebApp</RootNamespace>
<AssemblyName>Enyim.Caching.SampleWebApp</AssemblyName>
</PropertyGroup>
Expand All @@ -16,4 +16,4 @@
</Content>
</ItemGroup>

</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public MemcachedClientConfiguration(
_logger = loggerFactory.CreateLogger<MemcachedClientConfiguration>();

var options = optionsAccessor.Value;

#if NET5_0_OR_GREATER
if ((options == null || options.Servers.Count == 0) && configuration != null)
{
Expand Down
20 changes: 10 additions & 10 deletions src/Enyim.Caching/Enyim.Caching.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Description>EnyimMemcachedCore is a Memcached client library for .NET. Add services.AddEnyimMemcached() in Startup. Inject IMemcachedClient into constructors.</Description>
<Authors>cnblogs.com</Authors>
<TargetFrameworks>net6.0;net7.0;net8.0;net48;net481</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0;net48;net481</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyName>EnyimMemcachedCore</AssemblyName>
<PackageId>EnyimMemcachedCore</PackageId>
Expand All @@ -19,26 +19,26 @@
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)'!='net48' And '$(TargetFramework)'!='net481'">
<FrameworkReference Include="Microsoft.AspNetCore.App"/>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net48' Or '$(TargetFramework)'=='net481'">
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0"/>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0"/>
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="8.0.0"/>
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2"/>
<PackageReference Include="System.Net.Security" Version="4.3.2"/>
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="9.0.0" />
<PackageReference Include="System.Net.Security" Version="4.3.2" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json.Bson" Version="1.0.2"/>
<PackageReference Include="Newtonsoft.Json.Bson" Version="1.0.3" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="MessagePack" Version="2.5.187"/>
<PackageReference Include="MessagePack" Version="2.5.192" />
</ItemGroup>

<ItemGroup>
<None Include="../../README.md" Pack="true" PackagePath="\"/>
<None Include="../../README.md" Pack="true" PackagePath="\" />
</ItemGroup>
</Project>
12 changes: 6 additions & 6 deletions test/DistributedCacheTests/DistributedCacheTests.csproj
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="Xunit.Priority" Version="1.1.6" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.1">
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand All @@ -32,4 +32,4 @@
</None>
</ItemGroup>

</Project>
</Project>
14 changes: 7 additions & 7 deletions test/Enyim.Caching.Tests/Enyim.Caching.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
12 changes: 6 additions & 6 deletions test/Enyim.StressTest/Enyim.StressTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand All @@ -17,13 +17,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Enyim.Caching\Enyim.Caching.csproj" />
</ItemGroup>

</Project>
</Project>
51 changes: 22 additions & 29 deletions test/MemcachedTest/MemcachedClientTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -295,44 +295,37 @@ public async Task MultiGetTest()
[Fact]
public virtual async Task MultiGetWithCasTest()
{
using (var client = GetClient())
{
var keys = new List<string>();
var tasks = new List<Task<bool>>();

for (int i = 0; i < 10; i++)
{
string k = $"Hello_Multi_Get_{Guid.NewGuid()}_{new Random().Next()}" + i;
keys.Add(k);
using var client = GetClient();
var keys = new List<string>();
var tasks = new List<Task<bool>>();

tasks.Add(client.StoreAsync(StoreMode.Set, k, i, DateTime.Now.AddSeconds(300)));
}

await Task.WhenAll(tasks);
for (int i = 0; i < 10; i++)
{
string k = $"Hello_Multi_Get_{Guid.NewGuid()}_{new Random().Next()}" + i;
keys.Add(k);

foreach (var task in tasks)
{
Assert.True(await task, "Store failed");
}
bool success = await client.StoreAsync(StoreMode.Set, k, i, DateTime.Now.AddSeconds(600));
Assert.True(success, "Store failed");
}

var retvals = await client.GetWithCasAsync(keys);
var retvals = await client.GetWithCasAsync(keys);

Assert.Equal(keys.Count, retvals.Count);
await Task.Delay(100);

tasks.Clear();
for (int i = 0; i < keys.Count; i++)
{
string key = keys[i];
Assert.Equal(keys.Count, retvals.Count);

Assert.True(retvals.TryGetValue(key, out var value), "missing key: " + key);
Assert.Equal(value.Result, i);
Assert.NotEqual(value.Cas, (ulong)0);
for (int i = 0; i < keys.Count; i++)
{
string key = keys[i];

tasks.Add(client.RemoveAsync(key));
}
Assert.True(retvals.TryGetValue(key, out var value), "missing key: " + key);
Assert.Equal(value.Result, i);
Assert.NotEqual((ulong)0, value.Cas);

await Task.WhenAll(tasks);
tasks.Add(client.RemoveAsync(key));
}

await Task.WhenAll(tasks);
}

[Fact]
Expand Down
14 changes: 7 additions & 7 deletions test/MemcachedTest/MemcachedTest.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down

0 comments on commit 5afe0c6

Please sign in to comment.