Aspect that, when applied to a method, causes an invocation of this method to remove from the cache the result of invocations of other given methods with the same parameter values.
Namespace: Metalama.Patterns.Caching.Aspects
Assembly: Metalama.Patterns.Caching.Aspects.dll
Syntax
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
public sealed class InvalidateCacheAttribute : MethodAspect, IAspect<IMethod>, IAspect, ICompileTimeSerializable, ITemplateProvider, IEligible<IMethod>Remarks
The InvalidateCacheAttribute aspect provides compile-time validation that the parameters of the invalidated and invalidating methods match. Parameters are matched by name and type, and a compile-time error is reported if any required parameter cannot be matched.
By default, this aspect looks for the cached methods in the current type. To invalidate methods in a different type, use the constructor overload that accepts a Type parameter.
For imperative invalidation without an aspect, use the Invalidate<TReturn, TParam1>(ICachingService, Func<TParam1, TReturn>, TParam1) method or the InvalidateAsync<TReturn, TParam1>(ICachingService, Func<TParam1, TReturn>, TParam1, CancellationToken) method.
Constructors
| Name | Description |
|---|---|
| InvalidateCacheAttribute(params string[]) | Initializes a new instance of the InvalidateCacheAttribute class that invalidates method of the same type as the type to which the current InvalidateCacheAttribute aspect is being applied. |
| InvalidateCacheAttribute(Type, params string[]) | Initializes a new instance of the InvalidateCacheAttribute class that invalidates method of a different type than the type to which the current InvalidateCacheAttribute aspect is being applied. |
Properties
| Name | Description |
|---|---|
| AllowMultipleOverloads | Gets or sets a value indicating whether the current InvalidateCacheAttribute can match several overloads of the methods.
The default value is |
Methods
| Name | Description |
|---|---|
| BuildAspect(IAspectBuilder<IMethod>) | Defines the aspect implementation by adding advice, child aspects, and validators to the target declaration. |
| BuildEligibility(IEligibilityBuilder<IMethod>) | Configures the eligibility of the aspect or attribute by defining rules that determine which declarations the aspect can be applied to. |
| InitializeMethodInfoArray(IReadOnlyList<IMethod>, IField) |