AspireRedisExtensions.AddKeyedRedisClient Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Registers StackExchange.Redis.IConnectionMultiplexer as a keyed singleton for the given name
in the services provided by the builder
.
Enables retries, corresponding health check, logging, and telemetry.
public static void AddKeyedRedisClient (this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string name, Action<Aspire.StackExchange.Redis.StackExchangeRedisSettings>? configureSettings = default, Action<StackExchange.Redis.ConfigurationOptions>? configureOptions = default);
static member AddKeyedRedisClient : Microsoft.Extensions.Hosting.IHostApplicationBuilder * string * Action<Aspire.StackExchange.Redis.StackExchangeRedisSettings> * Action<StackExchange.Redis.ConfigurationOptions> -> unit
<Extension()>
Public Sub AddKeyedRedisClient (builder As IHostApplicationBuilder, name As String, Optional configureSettings As Action(Of StackExchangeRedisSettings) = Nothing, Optional configureOptions As Action(Of ConfigurationOptions) = Nothing)
Parameters
- builder
- IHostApplicationBuilder
The IHostApplicationBuilder to read config from and add services to.
- name
- String
The name of the component, which is used as the ServiceKey of the service and also to retrieve the connection string from the ConnectionStrings configuration section.
- configureSettings
- Action<StackExchangeRedisSettings>
An optional method that can be used for customizing the StackExchangeRedisSettings. It's invoked after the settings are read from the configuration.
- configureOptions
- Action<StackExchange.Redis.ConfigurationOptions>
An optional method that can be used for customizing the StackExchange.Redis.ConfigurationOptions. It's invoked after the options are read from the configuration.
Remarks
Reads the configuration from "Aspire:StackExchange:Redis:{name}" section.