Skip to content

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

Closed
@profet23

Description

@profet23

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-middlewareIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewaresfeature-output-caching

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions