Skip to content

MemoryOutputCacheStore doesn't respect "reason" for eviction and deletes tags erroneously #61524

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
profet23 opened this issue Apr 16, 2025 · 1 comment · May be fixed by #61529
Open

MemoryOutputCacheStore doesn't respect "reason" for eviction and deletes tags erroneously #61524

profet23 opened this issue Apr 16, 2025 · 1 comment · May be fixed by #61529
Labels
area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlewares feature-output-caching

Comments

@profet23
Copy link

profet23 commented Apr 16, 2025

void RemoveFromTags(object key, object? value, EvictionReason reason, object? state)

If an OutputCache entry is created with tags, and then is replaced, the PostEvictionCallback that is registered (RemoveFromTags) will remove tags, even though a new cache entry item has replaced the old cache entry.

The tags are then lost as the old entry's eviction has deleted the new entry's tags.

It seems like there needs to be some sort of state saved with the _taggedEntries (maybe just a guid?) And that state needs to be passed to the PostEvictionCallback so that only the tags that were registered with the correct entry are removed.

The RedisOutputCacheStore seems to function correctly.

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label Used by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically label Apr 16, 2025
@profet23
Copy link
Author

This appears to be a regression from this fix: #43728

profet23 added a commit to profet23/aspnetcore that referenced this issue Apr 17, 2025
…he do not have their tags removed on eviction.

Fixes dotnet#61524
@gfoidl gfoidl added feature-output-caching area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlewares and removed needs-area-label Used by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically labels Apr 17, 2025
profet23 added a commit to profet23/aspnetcore that referenced this issue Apr 17, 2025
…he do not have their tags removed on eviction.

Fixes dotnet#61524
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlewares feature-output-caching
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants