PostSharp.ILAPI ReferencePost­Sharp.​Patterns.​CachingCache­Attribute
Open sandboxFocus

CacheAttribute Class

Custom attribute that, when applied on a method, causes the return value of the method to be cached for the specific list of arguments passed to this method call.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching.dll
Syntax
[Metric("UsedFeatures", "Patterns.Caching.Cache")]
[ProvideAspectRole("Caching")]
[AspectRoleDependency]
[AspectRoleDependency]
[LinesOfCodeAvoided(3)]
[MulticastAttributeUsage(PersistMetaData = true)]
[Serializer]
public sealed class CacheAttribute : MethodInterceptionAspect, IMethodLevelAspectBuildSemantics, IAspectBuildSemantics, IValidableAnnotation, IAsyncMethodInterceptionAspect, IMethodInterceptionAspect, IMethodLevelAspect, IAspect

Constructors

Name Description
CacheAttribute() PostSharp.Patterns.Caching.CacheAttribute
CacheAttribute(PortableFormatterConstructorContext)

Properties

Name Description
AbsoluteExpiration

Gets or sets the total duration, in minutes, during which the result of the current method is stored in cache. The absolute expiration time is counted from the moment the method is evaluated and cached.

AutoReload

Determines whether the method calls are automatically reloaded (by re-evaluating the target method with the same arguments) when the cache item is removed from the cache.

IgnoreThisParameter

Determines whether the this instance should be a part of the cache key. The default value of this property is false, which means that by default the this instance is a part of the cache key.

Priority

Gets or sets the priority of the current method.

ProfileName

Gets or sets the name of the CachingProfile that contains the configuration of the current CacheAttribute.

SlidingExpiration

Gets or sets the duration, in minutes, during which the result of the current method is stored in cache after it has been added to or accessed from the cache. The expiration is extended every time the value is accessed from the cache.

Methods

Name Description
CompileTimeInitialize(MethodBase, AspectInfo)
CompileTimeValidate(MethodBase)
OnInvoke(MethodInterceptionArgs)
OnInvokeAsync(MethodInterceptionArgs)
RuntimeInitialize(MethodBase)