Skip to content

VitreousCachingServiceCollectionExtensions class

Namespace: Vitreous.Caching
Assembly: Vitreous.Caching.dll

Extension methods to register Vitreous caching pipeline behaviors.

public static class VitreousCachingServiceCollectionExtensions

object ← VitreousCachingServiceCollectionExtensions

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

AddVitreousCaching(IServiceCollection, Action<VitreousCachingOptions>?)

Section titled “ AddVitreousCaching(IServiceCollection, Action<VitreousCachingOptions>?)”

Registers the Vitreous caching pipeline behaviors backed by IDistributedCache.

public static IServiceCollection AddVitreousCaching(this IServiceCollection services, Action<VitreousCachingOptions>? configure = null)

services IServiceCollection

configure Action<VitreousCachingOptions>?

IServiceCollection

You must independently register an IDistributedCache implementation before calling this, for example:

// In-process memory cache (single instance):
services.AddDistributedMemoryCache();

// Redis (distributed, multi-instance):
services.AddStackExchangeRedisCache(o => o.Configuration = "localhost");

For full tag-based invalidation with Redis, use AddVitreousRedisCaching() from the Vitreous.Caching.Redis package instead.