Skip to content

SwrServiceCollectionExtensions.AddSwrForAspNetCore method

SwrServiceCollectionExtensions.AddSwrForAspNetCore method

Section titled “SwrServiceCollectionExtensions.AddSwrForAspNetCore method”

Registers Swr.Net services for ASP.NET Core applications. ISwr and ISwrStore are registered as Singleton — the cache is shared across all requests.

public static IServiceCollection AddSwrForAspNetCore(this IServiceCollection services,
Action<SwrOptions>? configure = null)
parameterdescription
servicesThe service collection.
configureOptional configuration callback for SwrOptions (StaleTime, CacheTime, etc.).

The service collection for chaining.