ValkeyBuilderExtensions.WithDataBindMount 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.
Adds a bind mount for the data folder to a Valkey container resource and enables Valkey persistence.
public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ValkeyResource> WithDataBindMount (this Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ValkeyResource> builder, string source, bool isReadOnly = false);
static member WithDataBindMount : Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ValkeyResource> * string * bool -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ValkeyResource>
<Extension()>
Public Function WithDataBindMount (builder As IResourceBuilder(Of ValkeyResource), source As String, Optional isReadOnly As Boolean = false) As IResourceBuilder(Of ValkeyResource)
Parameters
- builder
- IResourceBuilder<ValkeyResource>
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 Valkey persistence.
Defaults to false
.
Returns
The IResourceBuilder<T>.
Examples
Use WithPersistence(IResourceBuilder<ValkeyResource>, Nullable<TimeSpan>, Int64) to adjust Valkey persistence configuration, e.g.:
var valkey = builder.AddValkey("valkey")
.WithDataBindMount("mydata")
.WithPersistence(TimeSpan.FromSeconds(10), 5);