Class InvalidateCacheAttribute
Attribute to mark dispatch actions that should invalidate cache entries when executed. Applied at the class level to trigger cache invalidation after successful message processing.
[AttributeUsage(AttributeTargets.Class)]
public sealed class InvalidateCacheAttribute : Attribute
- Inheritance
-
InvalidateCacheAttribute
- Inherited Members
- Extension Methods
Properties
InvalidateOnFailure
Gets or initializes a value indicating whether invalidation runs even when the handler throws.
public bool InvalidateOnFailure { get; init; }
Property Value
Remarks
By default (false), cache invalidation runs only after the handler returns successfully — a handler that throws propagates its exception and leaves the cache untouched. When set to true, invalidation also runs when the handler throws (for example, a command that committed a partial write before failing), so stale entries are not served on the error path. An invalidation failure never masks the handler's original exception.
Tags
Gets or initializes the cache tags to invalidate when this action is executed. All cache entries with matching tags will be removed from the cache.
public string[] Tags { get; init; }
Property Value
- string[]
The cache tags to invalidate when this action is executed.