The Tags Property in OutputCache attribute is not working when using custom policies. #58785
Open
1 task done
Labels
area-middleware
Includes: URL rewrite, redirect, response cache/compression, session, and other general middlesware
feature-output-caching
Is there an existing issue for this?
Describe the bug
Hey, I'm trying to implement OutputCache with MultiTenancy Support, So I had to create a custom policy for that, I also used tags so that I can evict cache by tags + tenant id, this is how I'm doing it:
Custom OutputCache policy, MultitenantCachePolicy:
And this is how I register it:
And this is how I use it in controller endpoints:
[OutputCache(PolicyName = CacheConfig.CachePolicies.MultiTenantCache, Tags = [CacheConfig.CacheTags.DummyTag])]
The problem is that the
DummyTag
is not getting used at all, when i set a breakpoint inCacheRequestAsync
the context Tags list is empty, however, if i set the Tag using this way:It works this way, what am I doing wrong here?
Expected Behavior
I should be able to register one custom policy, however, when I use that policy in the OutputCache attribute, I should be able to use the
Tags
property so that each controller endpoint has its Tag while sharing the same policy.Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
8.0.403
Anything else?
No response
The text was updated successfully, but these errors were encountered: