IHttpCacheStore Interface

Provides persistent storage for HTTP cache entries.

public interface IHttpCacheStore

Methods

NameDescription
GetEntriesAsync(string, CancellationToken)Gets all entries associated with a primary cache key.
PruneObsoleteEntriesAsync(CancellationToken)Removes obsolete entries that are expired and cannot be reused when stale.
RemoveEntriesAsync(string, CancellationToken)Removes all entries associated with a primary cache key.
SetEntryAsync(string, HttpCachePersistenceEntry, CancellationToken)Adds or replaces a cache entry for a primary key.

GetEntriesAsync(string, CancellationToken)

Gets all entries associated with a primary cache key.

ValueTask<IReadOnlyCollection<HttpCachePersistenceEntry>> GetEntriesAsync(string primaryKey, CancellationToken cancellationToken)

Parameters

primaryKey string
The primary cache key.
cancellationToken CancellationToken
The cancellation token.

Returns

ValueTask<IReadOnlyCollection<HttpCachePersistenceEntry>>

PruneObsoleteEntriesAsync(CancellationToken)

IHttpCacheStore.cs

Removes obsolete entries that are expired and cannot be reused when stale.

public ValueTask PruneObsoleteEntriesAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken
The cancellation token.

Returns

ValueTask

RemoveEntriesAsync(string, CancellationToken)

Removes all entries associated with a primary cache key.

ValueTask RemoveEntriesAsync(string primaryKey, CancellationToken cancellationToken)

Parameters

primaryKey string
The primary cache key.
cancellationToken CancellationToken
The cancellation token.

Returns

ValueTask

SetEntryAsync(string, HttpCachePersistenceEntry, CancellationToken)

Adds or replaces a cache entry for a primary key.

ValueTask SetEntryAsync(string primaryKey, HttpCachePersistenceEntry entry, CancellationToken cancellationToken)

Parameters

primaryKey string
The primary cache key.
entry HttpCachePersistenceEntry
The entry to store.
cancellationToken CancellationToken
The cancellation token.

Returns

ValueTask