SqliteHttpCacheStore Class

Stores HTTP cache entries in a SQLite database.

public sealed class SqliteHttpCacheStore : IHttpCacheStore, IDisposable
Implements

Constructors

NameDescription
SqliteHttpCacheStore(string)Initializes a new instance of the SqliteHttpCacheStore class.

SqliteHttpCacheStore(string)

SqliteHttpCacheStore.cs

Initializes a new instance of the SqliteHttpCacheStore class.

public SqliteHttpCacheStore(string connectionString)

Parameters

connectionString string
The SQLite connection string.

Methods

NameDescription
Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
GetEntriesAsync(string, CancellationToken)Gets all entries associated with a primary cache key.
PruneObsoleteEntriesAsync(DateTimeOffset, CancellationToken)Removes expired entries that cannot be reused when stale.
PruneObsoleteEntriesAsync(CancellationToken)Removes expired entries that 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.

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

GetEntriesAsync(string, CancellationToken)

SqliteHttpCacheStore.cs

Gets all entries associated with a primary cache key.

net10.0

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

net11.0

public 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 overloads

PruneObsoleteEntriesAsync(DateTimeOffset, CancellationToken)

SqliteHttpCacheStore.cs

Removes expired entries that cannot be reused when stale.

net10.0

public ValueTask PruneObsoleteEntriesAsync(DateTimeOffset now, CancellationToken cancellationToken = default)

net11.0

public ValueTask PruneObsoleteEntriesAsync(DateTimeOffset now, CancellationToken cancellationToken = default)
Parameters
now DateTimeOffset
The current time used to evaluate expiration.
cancellationToken CancellationToken
The cancellation token.
Returns

ValueTask

PruneObsoleteEntriesAsync(CancellationToken)

SqliteHttpCacheStore.cs

Removes expired entries that cannot be reused when stale.

public ValueTask PruneObsoleteEntriesAsync(CancellationToken cancellationToken = default)
Parameters
cancellationToken CancellationToken
The cancellation token.
Returns

ValueTask

RemoveEntriesAsync(string, CancellationToken)

SqliteHttpCacheStore.cs

Removes all entries associated with a primary cache key.

net10.0

public ValueTask RemoveEntriesAsync(string primaryKey, CancellationToken cancellationToken)

net11.0

public ValueTask RemoveEntriesAsync(string primaryKey, CancellationToken cancellationToken)

Parameters

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

Returns

ValueTask

SetEntryAsync(string, HttpCachePersistenceEntry, CancellationToken)

SqliteHttpCacheStore.cs

Adds or replaces a cache entry for a primary key.

net10.0

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

net11.0

public 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