diff --git a/src/CacheTower.Serializers.SystemTextJson/CacheTower.Serializers.SystemTextJson.csproj b/src/CacheTower.Serializers.SystemTextJson/CacheTower.Serializers.SystemTextJson.csproj index 81c15652..4ff9b239 100644 --- a/src/CacheTower.Serializers.SystemTextJson/CacheTower.Serializers.SystemTextJson.csproj +++ b/src/CacheTower.Serializers.SystemTextJson/CacheTower.Serializers.SystemTextJson.csproj @@ -1,14 +1,14 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>netstandard2.0</TargetFramework> + <TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks> <Title>System.Text.Json Serializer for Cache Tower</Title> <Description>System.Text.Json cache serialization for Cache Tower</Description> <PackageTags>system.text.json;json;$(PackageBaseTags)</PackageTags> <Authors>James Turner</Authors> </PropertyGroup> - <ItemGroup> + <ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'"> <PackageReference Include="System.Text.Json" Version="6.0.9" /> </ItemGroup> diff --git a/src/CacheTower/CacheTower.csproj b/src/CacheTower/CacheTower.csproj index 3cf7596e..1cf2eca7 100644 --- a/src/CacheTower/CacheTower.csproj +++ b/src/CacheTower/CacheTower.csproj @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks> + <TargetFrameworks>netstandard2.0;netstandard2.1;net6.0</TargetFrameworks> <Title>Cache Tower</Title> <Description>A multi-layered caching system for .NET</Description> <PackageTags>inmemory,$(PackageBaseTags)</PackageTags> @@ -13,7 +13,13 @@ <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.4" /> <PackageReference Include="Nito.AsyncEx" Version="5.1.2" /> - <PackageReference Condition="'$(TargetFramework)' == 'netstandard2.0'" Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" /> + </ItemGroup> + + <ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'"> + <PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" /> + </ItemGroup> + + <ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netstandard2.1'"> <PackageReference Include="System.Memory" Version="4.5.5" /> </ItemGroup> @@ -21,5 +27,5 @@ <PackageReference Update="Microsoft.SourceLink.GitHub" Version="1.1.1" /> <PackageReference Update="TurnerSoftware.BuildVersioning" Version="0.5.0" /> </ItemGroup> - + </Project> diff --git a/src/CacheTower/Internal/CacheEntryKeyLock.cs b/src/CacheTower/Internal/CacheEntryKeyLock.cs index 62287389..fdcb049b 100644 --- a/src/CacheTower/Internal/CacheEntryKeyLock.cs +++ b/src/CacheTower/Internal/CacheEntryKeyLock.cs @@ -22,7 +22,7 @@ public bool AcquireLock(string cacheKey) keyLocks[cacheKey] = null; } return hasLock; -#elif NETSTANDARD2_1 +#else return keyLocks.TryAdd(cacheKey, null); #endif } @@ -56,7 +56,7 @@ private bool TryRemove(string cacheKey, out TaskCompletionSource<ICacheEntry>? c return true; } return false; -#elif NETSTANDARD2_1 +#else return keyLocks.Remove(cacheKey, out completionSource); #endif } diff --git a/src/CacheTower/Internal/MD5HashUtility.cs b/src/CacheTower/Internal/MD5HashUtility.cs index ff33d6b2..c5bc487e 100644 --- a/src/CacheTower/Internal/MD5HashUtility.cs +++ b/src/CacheTower/Internal/MD5HashUtility.cs @@ -17,7 +17,7 @@ public static unsafe string ComputeHash(string value) var bytes = Encoding.UTF8.GetBytes(value); var hashBytes = HashAlgorithm.ComputeHash(bytes); -#elif NETSTANDARD2_1 +#else public static unsafe string ComputeHash(ReadOnlySpan<char> value) { var encoding = Encoding.UTF8;