Share via


RedisBuilderExtensions.AddRedis Method

Definition

Overloads

AddRedis(IDistributedApplicationBuilder, String, Nullable<Int32>)

Source:
RedisBuilderExtensions.cs
Source:
RedisBuilderExtensions.cs
Source:
RedisBuilderExtensions.cs
Source:
RedisBuilderExtensions.cs
Source:
RedisBuilderExtensions.cs
Source:
RedisBuilderExtensions.cs
Source:
RedisBuilderExtensions.cs

Adds a Redis container to the application model.

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.RedisResource> AddRedis(this Aspire.Hosting.IDistributedApplicationBuilder builder, string name, int? port);
public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.RedisResource> AddRedis(this Aspire.Hosting.IDistributedApplicationBuilder builder, string name, int? port = default);
static member AddRedis : Aspire.Hosting.IDistributedApplicationBuilder * string * Nullable<int> -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.RedisResource>
<Extension()>
Public Function AddRedis (builder As IDistributedApplicationBuilder, name As String, port As Nullable(Of Integer)) As IResourceBuilder(Of RedisResource)
<Extension()>
Public Function AddRedis (builder As IDistributedApplicationBuilder, name As String, Optional port As Nullable(Of Integer) = Nothing) As IResourceBuilder(Of RedisResource)

Parameters

name
String

The name of the resource. This name will be used as the connection string name when referenced in a dependency.

port
Nullable<Int32>

The host port to bind the underlying container to.

Returns

A reference to the IResourceBuilder<T>.

Remarks

This resource includes built-in health checks. When this resource is referenced as a dependency using the WaitFor<T>(IResourceBuilder<T>, IResourceBuilder<IResource>) extension method then the dependent resource will wait until the Redis resource is able to service requests.

This version of the package defaults to the <inheritdoc cref="F:Aspire.Hosting.Redis.RedisContainerImageTags.Tag"></inheritdoc> tag of the <inheritdoc cref="F:Aspire.Hosting.Redis.RedisContainerImageTags.Image"></inheritdoc> container image.

Applies to

AddRedis(IDistributedApplicationBuilder, String, Nullable<Int32>, IResourceBuilder<ParameterResource>)

Source:
RedisBuilderExtensions.cs
Source:
RedisBuilderExtensions.cs
Source:
RedisBuilderExtensions.cs
Source:
RedisBuilderExtensions.cs
Source:
RedisBuilderExtensions.cs

Adds a Redis container to the application model.

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.RedisResource> AddRedis(this Aspire.Hosting.IDistributedApplicationBuilder builder, string name, int? port = default, Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource>? password = default);
static member AddRedis : Aspire.Hosting.IDistributedApplicationBuilder * string * Nullable<int> * Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource> -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.RedisResource>
<Extension()>
Public Function AddRedis (builder As IDistributedApplicationBuilder, name As String, Optional port As Nullable(Of Integer) = Nothing, Optional password As IResourceBuilder(Of ParameterResource) = Nothing) As IResourceBuilder(Of RedisResource)

Parameters

name
String

The name of the resource. This name will be used as the connection string name when referenced in a dependency.

port
Nullable<Int32>

The host port to bind the underlying container to.

password
IResourceBuilder<ParameterResource>

The parameter used to provide the password for the Redis resource. If null a random password will be generated.

Returns

A reference to the IResourceBuilder<T>.

Remarks

This resource includes built-in health checks. When this resource is referenced as a dependency using the WaitFor<T>(IResourceBuilder<T>, IResourceBuilder<IResource>) extension method then the dependent resource will wait until the Redis resource is able to service requests.

This version of the package defaults to the <inheritdoc cref="F:Aspire.Hosting.Redis.RedisContainerImageTags.Tag"></inheritdoc> tag of the <inheritdoc cref="F:Aspire.Hosting.Redis.RedisContainerImageTags.Image"></inheritdoc> container image.

Applies to