# WithPersistence

- Module: [Aspire.Hosting.Garnet](/reference/api/go/aspire.hosting.garnet.md)
- Version: `17.0.0`
- Kind: `method`
- Defined on: [`GarnetResource`](/reference/api/go/aspire.hosting.garnet/garnetresource.md)
- Source: [GitHub](https://github.com/microsoft/aspire/tree/2d325b13709752ba6d9a943635c5e2940a2530c0)

Configures a Garnet container resource for persistence.

## Definition

```go
func (GarnetResource) WithPersistence(options ...*WithPersistenceOptions) GarnetResource
```

## Parameters

- `options` (`...*WithPersistenceOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*WithPersistenceOptions` argument.

- `Interval` (`*float64`) -- The interval between snapshot exports. Defaults to 60 seconds.

## Returns

[`GarnetResource`](/reference/api/go/aspire.hosting.garnet/garnetresource.md) -- The resource builder.

Returns a handle; failures surface later via `Err()`.

## Applies to

- [`GarnetResource`](/reference/api/go/aspire.hosting.garnet/garnetresource.md)
