Udostępnij za pośrednictwem


RedisBuilderExtensions.WithDataBindMount Method

Definition

Adds a bind mount for the data folder to a Redis container resource and enables Redis persistence.

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.RedisResource> WithDataBindMount (this Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.RedisResource> builder, string source, bool isReadOnly = false);
static member WithDataBindMount : Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.RedisResource> * string * bool -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.RedisResource>
<Extension()>
Public Function WithDataBindMount (builder As IResourceBuilder(Of RedisResource), source As String, Optional isReadOnly As Boolean = false) As IResourceBuilder(Of RedisResource)

Parameters

builder
IResourceBuilder<RedisResource>

The resource builder.

source
String

The source directory on the host to mount into the container.

isReadOnly
Boolean

A flag that indicates if this is a read-only mount. Setting this to true will disable Redis persistence.
Defaults to false.

Returns

The IResourceBuilder<T>.

Remarks

Use WithPersistence(IResourceBuilder<RedisResource>, Nullable<TimeSpan>, Int64) to adjust Redis persistence configuration, e.g.:

var cache = builder.AddRedis("cache")
                   .WithDataBindMount("myredisdata")
                   .WithPersistence(TimeSpan.FromSeconds(10), 5);

Applies to