Skip to content

VitreousRedisCachingServiceCollectionExtensions class

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

Extension methods to register the Vitreous Redis caching backend.

public static class VitreousRedisCachingServiceCollectionExtensions

object ← VitreousRedisCachingServiceCollectionExtensions

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

AddVitreousRedisCaching(IServiceCollection, Action<VitreousRedisCachingOptions>?)

Section titled “ AddVitreousRedisCaching(IServiceCollection, Action<VitreousRedisCachingOptions>?)”

Registers Vitreous caching behaviors backed by Redis, with full support for tag-based cache invalidation via InvalidatesTags.

public static IServiceCollection AddVitreousRedisCaching(this IServiceCollection services, Action<VitreousRedisCachingOptions>? configure = null)

services IServiceCollection

The service collection.

configure Action<VitreousRedisCachingOptions>?

Configure Redis connection and key/tag prefixes.

IServiceCollection

This registers RedisVitreousCache as the IVitreousCache implementation. When ConnectionString is set, an IConnectionMultiplexer is registered from it (unless one is already registered). Otherwise register your own IConnectionMultiplexer, before or after calling this method.

The multiplexer is only resolved the first time a cacheable query or invalidating command runs, so other messages never wait on, or fail because of, Redis.