Skip to content
DocsTry Aspire
DocsTry

AspireRedisOutputCacheExtensions Methods

ClassMethods3 members
Provides extension methods for adding Redis output caching services to the Hosting.IHostApplicationBuilder.
AddKeyedRedisOutputCache(IHostApplicationBuilder, string, Action<StackExchangeRedisSettings>, Action<ConfigurationOptions>)Section titled AddKeyedRedisOutputCache(IHostApplicationBuilder, string, Action<StackExchangeRedisSettings>, Action<ConfigurationOptions>)extension
Adds Redis output caching services for the given name in the services provided by the builder.
public static class AspireRedisOutputCacheExtensions
{
public static void AddKeyedRedisOutputCache(
this IHostApplicationBuilder builder,
string name,
Action<StackExchangeRedisSettings>? configureSettings = null,
Action<ConfigurationOptions>? configureOptions = null)
{
// ...
}
}
builderIHostApplicationBuilderThe Hosting.IHostApplicationBuilder to read config from and add services to.
namestringThe name of the component, which is used as the ServiceDescriptor.ServiceKey of the service and also to retrieve the connection string from the ConnectionStrings configuration section.
configureSettingsAction<StackExchangeRedisSettings>optionalAn optional method that can be used for customizing the Redis.StackExchangeRedisSettings. It's invoked after the settings are read from the configuration.
configureOptionsAction<ConfigurationOptions>optionalAn optional method that can be used for customizing the Redis.ConfigurationOptions. It's invoked after the options are read from the configuration.
Reads the configuration from "Aspire:StackExchange:Redis:{name}" section. Also registers Redis.IConnectionMultiplexer as a singleton in the services provided by the builder. Enables retries, corresponding health check, logging, and telemetry.
AddRedisOutputCache(IHostApplicationBuilder, string, Action<StackExchangeRedisSettings>, Action<ConfigurationOptions>)Section titled AddRedisOutputCache(IHostApplicationBuilder, string, Action<StackExchangeRedisSettings>, Action<ConfigurationOptions>)extension
Adds Redis output caching services in the services provided by the builder.
public static class AspireRedisOutputCacheExtensions
{
public static void AddRedisOutputCache(
this IHostApplicationBuilder builder,
string connectionName,
Action<StackExchangeRedisSettings>? configureSettings = null,
Action<ConfigurationOptions>? configureOptions = null)
{
// ...
}
}
builderIHostApplicationBuilderThe Hosting.IHostApplicationBuilder to read config from and add services to.
connectionNamestringA name used to retrieve the connection string from the ConnectionStrings configuration section.
configureSettingsAction<StackExchangeRedisSettings>optionalAn optional method that can be used for customizing the Redis.StackExchangeRedisSettings. It's invoked after the settings are read from the configuration.
configureOptionsAction<ConfigurationOptions>optionalAn optional method that can be used for customizing the Redis.ConfigurationOptions. It's invoked after the options are read from the configuration.
Reads the configuration from "Aspire:StackExchange:Redis" section. Also registers Redis.IConnectionMultiplexer as a singleton in the services provided by the builder. Enables retries, corresponding health check, logging, and telemetry.
WithOutputCache(AspireRedisClientBuilder)Section titled WithOutputCache(AspireRedisClientBuilder)extensionAspireRedisClientBuilder
Configures the Redis client to provide output caching services through OutputCaching.IOutputCacheStore.
public static class AspireRedisOutputCacheExtensions
{
public static AspireRedisClientBuilder WithOutputCache(
this AspireRedisClientBuilder builder)
{
// ...
}
}
builderAspireRedisClientBuilderThe Redis.AspireRedisClientBuilder to configure.
AspireRedisClientBuilderThe Redis.AspireRedisClientBuilder for method chaining.