Share via


GarnetBuilderExtensions.WithDataBindMount Method

Definition

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

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

Parameters

builder
IResourceBuilder<GarnetResource>

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 Garnet persistence.
Defaults to false.

Returns

The IResourceBuilder<T>.

Examples

Use WithPersistence(IResourceBuilder<GarnetResource>, Nullable<TimeSpan>) to adjust Garnet persistence configuration, e.g.:

var garnet = builder.AddGarnet("garnet")
                   .WithDataBindMount("mydata")
                   .WithPersistence(TimeSpan.FromSeconds(10));

Applies to