Table of Contents

Interface ICacheHandler

Namespace
Apizr.Caching
Assembly
Apizr.dll

The cache handler method mapping interface Implement it to provide some caching features to Apizr

public interface ICacheHandler

Methods

ClearAsync(CancellationToken)

Map Apizr cache clearing method to your cache handler method

Task ClearAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

An optional cancellation token

Returns

Task

GetAsync<T>(string, CancellationToken)

Map Apizr cache getting method to your cache handler method

Task<T> GetAsync<T>(string key, CancellationToken cancellationToken = default)

Parameters

key string

The key to get from

cancellationToken CancellationToken

An optional cancellation token

Returns

Task<T>

Type Parameters

T

The expected value type

RemoveAsync(string, CancellationToken)

Map Apizr cache removing method to your cache handler method

Task<bool> RemoveAsync(string key, CancellationToken cancellationToken = default)

Parameters

key string

The key to remove from

cancellationToken CancellationToken

An optional cancellation token

Returns

Task<bool>

SetAsync(string, object, TimeSpan?, CancellationToken)

Map Apizr cache saving method to your cache handler method

Task SetAsync(string key, object value, TimeSpan? lifeSpan = null, CancellationToken cancellationToken = default)

Parameters

key string

The key to cache at

value object

The value to cache

lifeSpan TimeSpan?

The optional life span

cancellationToken CancellationToken

An optional cancellation token

Returns

Task