diff --git a/AspNetCore.DataProtection/DataProtection/NCache.OSS.AspNetCore.DataProtection.csproj b/AspNetCore.DataProtection/DataProtection/NCache.OSS.AspNetCore.DataProtection.csproj
index 3974953..275dd22 100644
--- a/AspNetCore.DataProtection/DataProtection/NCache.OSS.AspNetCore.DataProtection.csproj
+++ b/AspNetCore.DataProtection/DataProtection/NCache.OSS.AspNetCore.DataProtection.csproj
@@ -1,7 +1,7 @@
- netstandard2.0
+ net6.0
Copyright 2005-2026 Alachisoft. All rights reserved.
Alachisoft
Alachisoft
@@ -11,8 +11,8 @@
-
-
+
+
@@ -26,9 +26,6 @@
Always
-
- Always
-
diff --git a/AspNetCore.DataProtection/DataProtection/TaggingExtensionOSS.cs b/AspNetCore.DataProtection/DataProtection/TaggingExtensionOSS.cs
index 1c24b12..d509653 100644
--- a/AspNetCore.DataProtection/DataProtection/TaggingExtensionOSS.cs
+++ b/AspNetCore.DataProtection/DataProtection/TaggingExtensionOSS.cs
@@ -79,33 +79,32 @@ public static Dictionary GetUsingTag(this ICache cache, string tag
public static void RemoveUsingTag(this ICache cache, string tag)
{
- LockHandle lockHandle = null;
-
while (true)
{
- try
- {
- var keys = cache.Get>(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>(tag, true, TimeSpan.FromSeconds(10), ref lockHandle);
-
- if (keys == null && lockHandle == null)
- continue;
+ if (!locked)
+ {
+ continue;
+ }
- cache.RemoveBulk