Microsoft.Extensions.Caching.Hybrid.HybridCache
Provides multi-tier caching services building on IDistributedCache backends.
protected HybridCache()
public abstract ValueTask<T> GetOrCreateAsync<TState, T>(string key, TState state, Func<TState, CancellationToken, ValueTask<T>> factory, HybridCacheEntryOptions options = null, IEnumerable<string> tags = null, CancellationToken cancellationToken = default)
Asynchronously gets the value associated with the key if it exists, or generates a new entry using the provided key and a value from the given factory if the key is not found.
public ValueTask<T> GetOrCreateAsync<T>(string key, Func<CancellationToken, ValueTask<T>> factory, HybridCacheEntryOptions options = null, IEnumerable<string> tags = null, CancellationToken cancellationToken = default)
Asynchronously gets the value associated with the key if it exists, or generates a new entry using the provided key and a value from the given factory if the key is not found.
Asynchronously removes the value associated with the key if it exists.
public virtual ValueTask RemoveAsync(IEnumerable<string> keys, CancellationToken cancellationToken = default)
Asynchronously removes the value associated with the key if it exists.
public virtual ValueTask RemoveByTagAsync(IEnumerable<string> tags, CancellationToken cancellationToken = default)
Asynchronously removes all values associated with the specified tags.
public abstract ValueTask RemoveByTagAsync(string tag, CancellationToken cancellationToken = default)
Asynchronously removes all values associated with the specified tag.
public abstract ValueTask SetAsync<T>(string key, T value, HybridCacheEntryOptions options = null, IEnumerable<string> tags = null, CancellationToken cancellationToken = default)
Asynchronously sets or overwrites the value associated with the key.