GarnetBuilderExtensions.WithPersistence 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.
Overloads
WithPersistence(IResourceBuilder<GarnetResource>, Nullable<TimeSpan>) |
Configures a Garnet container resource for persistence. |
WithPersistence(IResourceBuilder<GarnetResource>, Nullable<TimeSpan>, Int64) |
Obsolete.
Configures a Garnet container resource for persistence. |
WithPersistence(IResourceBuilder<GarnetResource>, Nullable<TimeSpan>)
- Source:
- GarnetBuilderExtensions.cs
Configures a Garnet container resource for persistence.
public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.GarnetResource> WithPersistence (this Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.GarnetResource> builder, TimeSpan? interval = default);
static member WithPersistence : Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.GarnetResource> * Nullable<TimeSpan> -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.GarnetResource>
<Extension()>
Public Function WithPersistence (builder As IResourceBuilder(Of GarnetResource), Optional interval As Nullable(Of TimeSpan) = Nothing) As IResourceBuilder(Of GarnetResource)
Parameters
- builder
- IResourceBuilder<GarnetResource>
The resource builder.
Returns
The IResourceBuilder<T>.
Examples
Use with WithDataBindMount(IResourceBuilder<GarnetResource>, String, Boolean) or WithDataVolume(IResourceBuilder<GarnetResource>, String, Boolean) to persist Garnet data across sessions with custom persistence configuration, e.g.:
var cache = builder.AddGarnet("cache")
.WithDataVolume()
.WithPersistence(TimeSpan.FromSeconds(10));
Applies to
WithPersistence(IResourceBuilder<GarnetResource>, Nullable<TimeSpan>, Int64)
- Source:
- GarnetBuilderExtensions.cs
- Source:
- GarnetBuilderExtensions.cs
Caution
This method is obsolete and will be removed in a future version. Use the overload without the keysChangedThreshold parameter.
Configures a Garnet container resource for persistence.
public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.GarnetResource> WithPersistence (this Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.GarnetResource> builder, TimeSpan? interval = default, long keysChangedThreshold = 1);
[System.Obsolete("This method is obsolete and will be removed in a future version. Use the overload without the keysChangedThreshold parameter.")]
public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.GarnetResource> WithPersistence (this Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.GarnetResource> builder, TimeSpan? interval, long keysChangedThreshold);
static member WithPersistence : Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.GarnetResource> * Nullable<TimeSpan> * int64 -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.GarnetResource>
[<System.Obsolete("This method is obsolete and will be removed in a future version. Use the overload without the keysChangedThreshold parameter.")>]
static member WithPersistence : Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.GarnetResource> * Nullable<TimeSpan> * int64 -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.GarnetResource>
<Extension()>
Public Function WithPersistence (builder As IResourceBuilder(Of GarnetResource), Optional interval As Nullable(Of TimeSpan) = Nothing, Optional keysChangedThreshold As Long = 1) As IResourceBuilder(Of GarnetResource)
<Extension()>
Public Function WithPersistence (builder As IResourceBuilder(Of GarnetResource), interval As Nullable(Of TimeSpan), keysChangedThreshold As Long) As IResourceBuilder(Of GarnetResource)
Parameters
- builder
- IResourceBuilder<GarnetResource>
The resource builder.
- keysChangedThreshold
- Int64
The number of key change operations required to trigger a snapshot at the interval. Defaults to 1.
Returns
The IResourceBuilder<T>.
- Attributes
Examples
Use with WithDataBindMount(IResourceBuilder<GarnetResource>, String, Boolean) or WithDataVolume(IResourceBuilder<GarnetResource>, String, Boolean) to persist Garnet data across sessions with custom persistence configuration, e.g.:
var cache = builder.AddGarnet("cache")
.WithDataVolume()
.WithPersistence(TimeSpan.FromSeconds(10));