RedisHttpCacheStore Class
Stores HTTP cache entries in Redis.
public sealed class RedisHttpCacheStore : IHttpCacheStore- Implements
Constructors
| Name | Description |
|---|---|
| RedisHttpCacheStore(IConnectionMultiplexer, string) | Initializes a new instance of the RedisHttpCacheStore class. |
RedisHttpCacheStore(IConnectionMultiplexer, string)
RedisHttpCacheStore.csInitializes a new instance of the RedisHttpCacheStore class.
public RedisHttpCacheStore(IConnectionMultiplexer connectionMultiplexer, string keyPrefix = "Meziantou:HttpCache")Parameters
connectionMultiplexerIConnectionMultiplexer- The Redis connection multiplexer.
keyPrefixstring- The key prefix used to isolate cache entries in Redis.
Methods
| Name | Description |
|---|---|
| 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. |
GetEntriesAsync(string, CancellationToken)
RedisHttpCacheStore.csGets 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
primaryKeystring- The primary cache key.
cancellationTokenCancellationToken- The cancellation token.
Returns
PruneObsoleteEntriesAsync overloads
PruneObsoleteEntriesAsync(DateTimeOffset, CancellationToken)
RedisHttpCacheStore.csRemoves 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
nowDateTimeOffset- The current time used to evaluate expiration.
cancellationTokenCancellationToken- The cancellation token.
Returns
PruneObsoleteEntriesAsync(CancellationToken)
RedisHttpCacheStore.csRemoves expired entries that cannot be reused when stale.
public ValueTask PruneObsoleteEntriesAsync(CancellationToken cancellationToken = default)RemoveEntriesAsync(string, CancellationToken)
RedisHttpCacheStore.csRemoves 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
primaryKeystring- The primary cache key.
cancellationTokenCancellationToken- The cancellation token.
Returns
SetEntryAsync(string, HttpCachePersistenceEntry, CancellationToken)
RedisHttpCacheStore.csAdds 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
primaryKeystring- The primary cache key.
entryHttpCachePersistenceEntry- The entry to store.
cancellationTokenCancellationToken- The cancellation token.