Class CacheAttribute
- Namespace
- Apizr.Caching.Attributes
- Assembly
- Apizr.dll
Tells Apizr to cache all methods returning result when decorating an interface or a specific one when decorating a method You have to provide an ICacheHandler mapping implementation to Apizr to use this feature
[AttributeUsage(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Interface)]
public class CacheAttribute : CacheAttributeBase, _Attribute
- Inheritance
-
CacheAttribute
- Implements
- Inherited Members
Constructors
CacheAttribute()
Cache with no specific lifetime, default FetchOrGet mode and no invalidation on error
public CacheAttribute()
CacheAttribute(CacheMode)
Cache with no specific lifetime, no invalidation on error but a specific cache mode
public CacheAttribute(CacheMode mode)
Parameters
mode
CacheModeFetchOrGet returns fresh data when request succeed otherwise cached one, where GetOrFetch returns cached data if we get some otherwise fresh one
CacheAttribute(CacheMode, bool)
Cache with a specific cache and invalidation on error, but no specific lifetime
public CacheAttribute(CacheMode mode, bool shouldInvalidateOnError)
Parameters
mode
CacheModeFetchOrGet returns fresh data when request succeed otherwise cached one, where GetOrFetch returns cached data if we get some otherwise fresh one
shouldInvalidateOnError
boolShould invalidate on error
CacheAttribute(CacheMode, string)
Cache with a specific cache and mode specific lifetime, but no invalidation on error
public CacheAttribute(CacheMode mode, string lifeSpanRepresentation)
Parameters
mode
CacheModeFetchOrGet returns fresh data when request succeed otherwise cached one, where GetOrFetch returns cached data if we get some otherwise fresh one
lifeSpanRepresentation
stringTimeSpan representation to parse
CacheAttribute(CacheMode, string, bool)
Cache with a specific cache mode, a specific lifetime and invalidation on error
public CacheAttribute(CacheMode mode, string lifeSpanRepresentation, bool shouldInvalidateOnError)
Parameters
mode
CacheModeFetchOrGet returns fresh data when request succeed otherwise cached one, where GetOrFetch returns cached data if we get some otherwise fresh one
lifeSpanRepresentation
stringThis specific caching lifetime
shouldInvalidateOnError
boolShould invalidate on error
CacheAttribute(bool)
Cache with no specific lifetime, default FetchOrGet mode but with or without invalidation on error
public CacheAttribute(bool shouldInvalidateOnError)
Parameters
shouldInvalidateOnError
boolShould invalidate on error
CacheAttribute(string)
Cache with default FetchOrGet mode, no invalidation on error but with a specific lifetime
public CacheAttribute(string lifeSpanRepresentation)
Parameters
lifeSpanRepresentation
stringTimeSpan representation to parse
CacheAttribute(TimeSpan, bool)
Cache with a specific lifetime and invalidation on error, but default FetchOrGet mode
public CacheAttribute(TimeSpan lifeSpan, bool shouldInvalidateOnError)