Currently, the only way to specify your own tags for output cache items is to implement IDisplayedContentItemHandler. This is counter intuitive for two reasons:
- This interface only allows you to return ints, whereas cache tags are strings.
- The naming of this interface and the methods on it mean that using it for anything other than returning the IDs of content items that have been displayed is a misuse of the interface.
I propose a new interface ICacheTagProvider that can be implemented multiple times and each implementation can provide a collection of string tags that will be added to the cache item.
The addition of this extension point would open up a number of new opportunities for developers to tag items by more than just displayed content IDs. Examples include the ability to tag (and therefore subsequently remove cache items) based on authentication state, and to tag and remove cache items based on content changes in external systems.
Currently, the only way to specify your own tags for output cache items is to implement
IDisplayedContentItemHandler. This is counter intuitive for two reasons:I propose a new interface
ICacheTagProviderthat can be implemented multiple times and each implementation can provide a collection of string tags that will be added to the cache item.The addition of this extension point would open up a number of new opportunities for developers to tag items by more than just displayed content IDs. Examples include the ability to tag (and therefore subsequently remove cache items) based on authentication state, and to tag and remove cache items based on content changes in external systems.