Class CacheAttributeBase
- 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
public abstract class CacheAttributeBase : Attribute, _Attribute
- Inheritance
-
CacheAttributeBase
- Implements
- Derived
- Inherited Members
Constructors
CacheAttributeBase()
Cache with no specific lifetime, default FetchOrGet mode and no invalidation on error
protected CacheAttributeBase()
CacheAttributeBase(CacheMode)
Cache with no specific lifetime, no invalidation on error but a specific cache mode
protected CacheAttributeBase(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
CacheAttributeBase(CacheMode, bool)
Cache with a specific cache and invalidation on error, but no specific lifetime
protected CacheAttributeBase(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
CacheAttributeBase(CacheMode, TimeSpan?, bool)
protected CacheAttributeBase(CacheMode mode, TimeSpan? lifeSpan, bool shouldInvalidateOnError)
Parameters
CacheAttributeBase(CacheMode, string)
Cache with a specific cache and mode specific lifetime, but no invalidation on error
protected CacheAttributeBase(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
CacheAttributeBase(CacheMode, string, bool)
Cache with a specific cache mode, a specific lifetime and invalidation on error
protected CacheAttributeBase(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
CacheAttributeBase(bool)
Cache with no specific lifetime, default FetchOrGet mode but with or without invalidation on error
protected CacheAttributeBase(bool shouldInvalidateOnError)
Parameters
shouldInvalidateOnError
boolShould invalidate on error
CacheAttributeBase(string)
Cache with default FetchOrGet mode, no invalidation on error but with a specific lifetime
protected CacheAttributeBase(string lifeSpanRepresentation)
Parameters
lifeSpanRepresentation
stringTimeSpan representation to parse
CacheAttributeBase(TimeSpan, bool)
Cache with a specific lifetime and invalidation on error, but default FetchOrGet mode
protected CacheAttributeBase(TimeSpan lifeSpan, bool shouldInvalidateOnError)
Parameters
lifeSpan
TimeSpanThis specific caching lifetime
shouldInvalidateOnError
boolShould invalidate on error
Properties
LifeSpan
This specific caching lifetime
public TimeSpan? LifeSpan { get; protected set; }
Property Value
Mode
Define the caching behaviour (default: FetchOrGet = api data first otherwise cache)
public CacheMode Mode { get; protected set; }
Property Value
ShouldInvalidateOnError
Tells Apizr to remove the cache on error
public bool ShouldInvalidateOnError { get; protected set; }