Table of Contents

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 CacheMode

FetchOrGet 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 CacheMode

FetchOrGet returns fresh data when request succeed otherwise cached one, where GetOrFetch returns cached data if we get some otherwise fresh one

shouldInvalidateOnError bool

Should invalidate on error

CacheAttributeBase(CacheMode, TimeSpan?, bool)

protected CacheAttributeBase(CacheMode mode, TimeSpan? lifeSpan, bool shouldInvalidateOnError)

Parameters

mode CacheMode
lifeSpan TimeSpan?
shouldInvalidateOnError bool

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 CacheMode

FetchOrGet returns fresh data when request succeed otherwise cached one, where GetOrFetch returns cached data if we get some otherwise fresh one

lifeSpanRepresentation string

TimeSpan 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 CacheMode

FetchOrGet returns fresh data when request succeed otherwise cached one, where GetOrFetch returns cached data if we get some otherwise fresh one

lifeSpanRepresentation string

This specific caching lifetime

shouldInvalidateOnError bool

Should 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 bool

Should 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 string

TimeSpan 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 TimeSpan

This specific caching lifetime

shouldInvalidateOnError bool

Should invalidate on error

Properties

LifeSpan

This specific caching lifetime

public TimeSpan? LifeSpan { get; protected set; }

Property Value

TimeSpan?

Mode

Define the caching behaviour (default: FetchOrGet = api data first otherwise cache)

public CacheMode Mode { get; protected set; }

Property Value

CacheMode

ShouldInvalidateOnError

Tells Apizr to remove the cache on error

public bool ShouldInvalidateOnError { get; protected set; }

Property Value

bool