diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e12536d2..b3338755 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,10 +16,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup .NET SDK 8.0.x + - name: Setup .NET SDK 9.0.x uses: actions/setup-dotnet@v3 with: - dotnet-version: 8.0.x + dotnet-version: 9.0.x - name: Show dotnet Version run: | diff --git a/.github/workflows/buildandtest.yml b/.github/workflows/buildandtest.yml index d6cdeadc..a7f79bf5 100644 --- a/.github/workflows/buildandtest.yml +++ b/.github/workflows/buildandtest.yml @@ -38,10 +38,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup .NET SDK 8.0.x + - name: Setup .NET SDK 9.0.x uses: actions/setup-dotnet@v3 with: - dotnet-version: 8.0.x + dotnet-version: 9.0.x - name: Show dotnet Version run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 69fb722b..aba877fd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,7 +17,7 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v3 with: - dotnet-version: 8.0.x + dotnet-version: 9.0.x - name: Build with dotnet run: dotnet build --configuration Release /home/runner/work/EasyCaching/EasyCaching/EasyCaching.sln - name: Pack with dotnet diff --git a/.github/workflows/release_stable.yml b/.github/workflows/release_stable.yml index d6aedfff..b15f938e 100644 --- a/.github/workflows/release_stable.yml +++ b/.github/workflows/release_stable.yml @@ -15,7 +15,7 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v3 with: - dotnet-version: 8.0.x + dotnet-version: 9.0.x - name: Build with dotnet run: dotnet build --configuration Release /home/runner/work/EasyCaching/EasyCaching/EasyCaching.sln - name: Pack with dotnet diff --git a/bus/EasyCaching.Bus.Zookeeper/DefaultZookeeperBus.cs b/bus/EasyCaching.Bus.Zookeeper/DefaultZookeeperBus.cs index e314bf79..1ed0734b 100644 --- a/bus/EasyCaching.Bus.Zookeeper/DefaultZookeeperBus.cs +++ b/bus/EasyCaching.Bus.Zookeeper/DefaultZookeeperBus.cs @@ -1,18 +1,18 @@ -namespace EasyCaching.Bus.Zookeeper +using EasyCaching.Core; +using EasyCaching.Core.Bus; +using EasyCaching.Core.Serialization; +using Microsoft.Extensions.Options; +using org.apache.zookeeper; +using org.apache.zookeeper.data; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace EasyCaching.Bus.Zookeeper { - using EasyCaching.Core; - using EasyCaching.Core.Bus; - using EasyCaching.Core.Serialization; - using Microsoft.Extensions.Options; - using org.apache.zookeeper; - using org.apache.zookeeper.data; - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using System.Threading; - using System.Threading.Tasks; - public class DefaultZookeeperBus : EasyCachingAbstractBus { /// @@ -41,7 +41,7 @@ public class DefaultZookeeperBus : EasyCachingAbstractBus /// /// lock /// - private readonly object _zkEventLock = new object(); + private readonly Lock _zkEventLock = LockFactory.Create(); /// /// The serializer. @@ -214,7 +214,7 @@ private async Task SubscribeDataChange(WatchedEvent @event) /// private async Task ReZkConnect() { - if (!Monitor.TryEnter(_zkEventLock, _zkBusOptions.ConnectionTimeout)) + if (!_zkEventLock.TryEnter(_zkBusOptions.ConnectionTimeout)) return; try { @@ -234,7 +234,7 @@ private async Task ReZkConnect() } finally { - Monitor.Exit(_zkEventLock); + _zkEventLock.Exit(); } } diff --git a/bus/EasyCaching.Bus.Zookeeper/EasyCaching.Bus.Zookeeper.csproj b/bus/EasyCaching.Bus.Zookeeper/EasyCaching.Bus.Zookeeper.csproj index 23c4c22d..c1cb329c 100644 --- a/bus/EasyCaching.Bus.Zookeeper/EasyCaching.Bus.Zookeeper.csproj +++ b/bus/EasyCaching.Bus.Zookeeper/EasyCaching.Bus.Zookeeper.csproj @@ -3,7 +3,8 @@ - netstandard2.0;net8.0 + netstandard2.0;net8.0;net9.0 + latest ncc;Catcher Wong ncc;Catcher Wong $(EasyCachingZookeeperBusPackageVersion) @@ -40,4 +41,11 @@ + + + + + + + diff --git a/sample/EasyCaching.Demo.ConsoleApp/EasyCaching.Demo.ConsoleApp.csproj b/sample/EasyCaching.Demo.ConsoleApp/EasyCaching.Demo.ConsoleApp.csproj index 1d45c7c8..d5d5a26d 100644 --- a/sample/EasyCaching.Demo.ConsoleApp/EasyCaching.Demo.ConsoleApp.csproj +++ b/sample/EasyCaching.Demo.ConsoleApp/EasyCaching.Demo.ConsoleApp.csproj @@ -2,7 +2,7 @@ Exe - net8.0 + net9.0 false diff --git a/sample/EasyCaching.Demo.Interceptors/EasyCaching.Demo.Interceptors.csproj b/sample/EasyCaching.Demo.Interceptors/EasyCaching.Demo.Interceptors.csproj index fdf6b5fb..3706621a 100644 --- a/sample/EasyCaching.Demo.Interceptors/EasyCaching.Demo.Interceptors.csproj +++ b/sample/EasyCaching.Demo.Interceptors/EasyCaching.Demo.Interceptors.csproj @@ -1,7 +1,7 @@  - net8.0 + net9.0 diff --git a/sample/EasyCaching.Demo.Locks/EasyCaching.Demo.Locks.csproj b/sample/EasyCaching.Demo.Locks/EasyCaching.Demo.Locks.csproj index 0e6245ee..624823a1 100644 --- a/sample/EasyCaching.Demo.Locks/EasyCaching.Demo.Locks.csproj +++ b/sample/EasyCaching.Demo.Locks/EasyCaching.Demo.Locks.csproj @@ -1,7 +1,7 @@  - net8.0 + net9.0 enable enable diff --git a/sample/EasyCaching.Demo.Providers/EasyCaching.Demo.Providers.csproj b/sample/EasyCaching.Demo.Providers/EasyCaching.Demo.Providers.csproj index aac47298..74bb9dfc 100644 --- a/sample/EasyCaching.Demo.Providers/EasyCaching.Demo.Providers.csproj +++ b/sample/EasyCaching.Demo.Providers/EasyCaching.Demo.Providers.csproj @@ -1,7 +1,7 @@  - net8.0 + net9.0 diff --git a/sample/EasyCaching.Demo.ResponseCaching/EasyCaching.Demo.ResponseCaching.csproj b/sample/EasyCaching.Demo.ResponseCaching/EasyCaching.Demo.ResponseCaching.csproj index 03f9b2c7..d12a87a2 100644 --- a/sample/EasyCaching.Demo.ResponseCaching/EasyCaching.Demo.ResponseCaching.csproj +++ b/sample/EasyCaching.Demo.ResponseCaching/EasyCaching.Demo.ResponseCaching.csproj @@ -1,7 +1,7 @@  - net8.0 + net9.0 diff --git a/src/EasyCaching.Core/DistributedLock/DistributedLock.cs b/src/EasyCaching.Core/DistributedLock/DistributedLock.cs index 4ae267c0..9003cf33 100644 --- a/src/EasyCaching.Core/DistributedLock/DistributedLock.cs +++ b/src/EasyCaching.Core/DistributedLock/DistributedLock.cs @@ -9,7 +9,7 @@ namespace EasyCaching.Core.DistributedLock public class DistributedLock : MemoryLock { private readonly IDistributedLockProvider _provider; - private readonly object _syncObj = new object(); + private readonly Lock _syncObj = LockFactory.Create(); private readonly DistributedLockOptions _options; private readonly ILogger _logger; diff --git a/src/EasyCaching.Core/DistributedLock/MemoryLock.cs b/src/EasyCaching.Core/DistributedLock/MemoryLock.cs index c1d01f57..5facbcfd 100644 --- a/src/EasyCaching.Core/DistributedLock/MemoryLock.cs +++ b/src/EasyCaching.Core/DistributedLock/MemoryLock.cs @@ -16,7 +16,7 @@ public class MemoryLock : IDistributedLock public string Key { get; } - private readonly object _syncObj = new object(); + private readonly Lock _syncObj = LockFactory.Create(); public MemoryLock(string key) => Key = key; diff --git a/src/EasyCaching.Core/EasyCaching.Core.csproj b/src/EasyCaching.Core/EasyCaching.Core.csproj index 1a373291..81a35085 100644 --- a/src/EasyCaching.Core/EasyCaching.Core.csproj +++ b/src/EasyCaching.Core/EasyCaching.Core.csproj @@ -2,7 +2,8 @@ - netstandard2.0;net8.0 + netstandard2.0;net8.0;net9.0 + latest ncc;Catcher Wong ncc;Catcher Wong $(EasyCachingCorePackageVersion) @@ -44,8 +45,21 @@ + + + + + + + + + + + + + diff --git a/test/EasyCaching.UnitTests/CachingTests/CSRedisCachingProviderTest.cs b/test/EasyCaching.UnitTests/CachingTests/CSRedisCachingProviderTest.cs index 8ded8e1a..c0e16ac2 100644 --- a/test/EasyCaching.UnitTests/CachingTests/CSRedisCachingProviderTest.cs +++ b/test/EasyCaching.UnitTests/CachingTests/CSRedisCachingProviderTest.cs @@ -42,7 +42,7 @@ protected override IEasyCachingProvider CreateCachingProvider(Action diff --git a/test/EasyCaching.UnitTests/CachingTests/MemcachedProviderTest.cs b/test/EasyCaching.UnitTests/CachingTests/MemcachedProviderTest.cs index 0d5cf30a..c1275375 100644 --- a/test/EasyCaching.UnitTests/CachingTests/MemcachedProviderTest.cs +++ b/test/EasyCaching.UnitTests/CachingTests/MemcachedProviderTest.cs @@ -417,7 +417,7 @@ public void Provider_Information_Should_Be_Correct() public class MemcachedProviderNoConnectionTest { [Fact] - public async void NoConnectionTest() + public async Task NoConnectionTest() { IServiceCollection services = new ServiceCollection(); services.AddLogging(); diff --git a/test/EasyCaching.UnitTests/CachingTests/MemoryCachingProviderTest.cs b/test/EasyCaching.UnitTests/CachingTests/MemoryCachingProviderTest.cs index 511e5f2d..e32e0071 100644 --- a/test/EasyCaching.UnitTests/CachingTests/MemoryCachingProviderTest.cs +++ b/test/EasyCaching.UnitTests/CachingTests/MemoryCachingProviderTest.cs @@ -156,7 +156,7 @@ public void Evicted_Event_Should_Trigger_When_GetExpiredItems() } [Fact] - public async void Issues497_GetCountAsync_Check_Expires_Test() + public async Task Issues497_GetCountAsync_Check_Expires_Test() { for (int i = 0; i < 9; i++) {