Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Copyright>Copyright 2005-2026 Alachisoft. All rights reserved.</Copyright>
<Authors>Alachisoft</Authors>
<Company>Alachisoft</Company>
Expand All @@ -11,8 +11,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Alachisoft.NCache.Opensource.SDK" Version="5.3.6.2" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection" Version="8.0.0" />
<PackageReference Include="Alachisoft.NCache.Opensource.SDK" Version="5.3.603" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection" Version="10.0.12" />
</ItemGroup>

<ItemGroup>
Expand All @@ -26,9 +26,6 @@
<None Update="config.ncconf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="tls.ncconf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
33 changes: 16 additions & 17 deletions AspNetCore.DataProtection/DataProtection/TaggingExtensionOSS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,33 +79,32 @@ public static Dictionary<string, T> GetUsingTag<T>(this ICache cache, string tag

public static void RemoveUsingTag(this ICache cache, string tag)
{
LockHandle lockHandle = null;

while (true)
{
try
{
var keys = cache.Get<List<string>>(tag);
//lockKey refuses a key that does not exist
if (!cache.Contains(tag))
return;

// the lock expires on its own
bool locked = cache.LockKey(tag, out var lockToken, TimeSpan.FromSeconds(19));

if (keys == null)
return;


keys = cache.Get<List<string>>(tag, true, TimeSpan.FromSeconds(10), ref lockHandle);

if (keys == null && lockHandle == null)
continue;
if (!locked)
{
continue;
}

cache.RemoveBulk<object>(keys, out var removedKeys);
try
{
var keys = cache.Get<List<string>>(tag);

// Remove tag itself
if (keys != null && keys.Count > 0)
cache.RemoveBulk<object>(keys, out var removedKeys);
cache.Remove(tag);
}
finally
{
if (lockHandle != null)
cache.Unlock(tag, lockHandle);
cache.UnlockKey(tag, lockToken);

}
break;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>NCacheDataProtectionSample</RootNamespace>
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
</PropertyGroup>


<ItemGroup>
<PackageReference Include="NCache.OSS.AspNetCore.DataProtection" Version="5.3.6" />
<ProjectReference Include="..\DataProtection\NCache.OSS.AspNetCore.DataProtection.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion AspNetCore.DataProtection/Sample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
var builder = WebApplication.CreateBuilder(args);

// Read NCache settings from appsettings.json
var cacheName = builder.Configuration["NCacheSettings:CacheName"] ?? "demoCache";
var cacheName = builder.Configuration["NCacheSettings:CacheName"] ?? "defaultCache";
var appId = builder.Configuration["NCacheSettings:ApplicationId"] ?? "NCacheDataProtectionSample";
var keyName = builder.Configuration["NCacheSettings:KeyName"] ?? "DataProtection-Keys";

Expand Down
4 changes: 2 additions & 2 deletions AspNetCore.DataProtection/Sample/client.ncconf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<ncache-server connection-retries="5" retry-connection-delay="0" retry-interval="1" client-request-timeout="90" connection-timeout="5" port="9800" />
<cache id="demoCache" enable-client-logs="False" log-level="error">
<server name="20.200.20.34"/>
<cache id="defaultCache" enable-client-logs="False" log-level="error">
<server name="20.200.20.44"/>
</cache>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,14 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Alachisoft.NCache.Opensource.SDK" Version="5.3.6.2" />
<PackageReference Include="Alachisoft.NCache.Opensource.SDK" Version="5.3.603" />
</ItemGroup>

<ItemGroup>
<None Update="client.ncconf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="tls.ncconf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>

</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

builder.Services.AddNCacheOutputCacheProvider(options =>
{
options.CacheName = "demoCache";
options.CacheName = "defaultCache";

options.ServerList = new List<NCacheOutputCacheOptions.ServerConfig>
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"NCacheOutputCache": {
"CacheName": "demoCache",
"CacheName": "defaultCache",
"EnabledLogs": true,
"EnableDetailLogs": true,
"ServerList": [
{
"Ip": "127.0.0.1",
"Ip": "20.200.20.44",
"Port": 9800
}
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>5.3.6.1</Version>
<LangVersion>latest</LangVersion>
Expand All @@ -26,8 +26,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Alachisoft.NCache.Opensource.SDK" Version="5.3.6.2" />
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.2.9" />
<PackageReference Include="Alachisoft.NCache.Opensource.SDK" Version="5.3.603" />
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.2.13" />
</ItemGroup>
<PropertyGroup>
<AssemblyName>Alachisoft.NCache.AspNetCore.SignalR</AssemblyName>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Alachisoft.NCache.Opensource.SDK" Version="5.3.6.2" />
<PackageReference Include="Alachisoft.NCache.Opensource.SDK" Version="5.3.603" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Alachisoft.NCache.Opensource.SDK" Version="5.3.6.2" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.Abstractions" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="2.0.0" />
<PackageReference Include="Alachisoft.NCache.Opensource.SDK" Version="5.3.603" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.1.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading
Loading