# GarnetResource

- Module: [Aspire.Hosting.Garnet](/reference/api/typescript/aspire.hosting.garnet.md)
- Version: `13.4.0`
- Kind: `handle`
- Source: [GitHub](https://github.com/microsoft/aspire)

A resource that represents a Garnet resource independent of the hosting model.

## Definition

```typescript
interface GarnetResource
  extends IComputeResource,
    IExpressionValue,
    IManifestExpressionProvider,
    IResource,
    IResourceWithArgs,
    IResourceWithConnectionString,
    IResourceWithEndpoints,
    IResourceWithEnvironment,
    IResourceWithProbes,
    IResourceWithWaitSupport,
    IValueProvider,
    IValueWithReferences {
  readonly connectionStringExpression: ReferenceExpression;
  readonly host: EndpointReferenceExpression;
  readonly passwordParameter: ParameterResource;
  readonly port: EndpointReferenceExpression;
  readonly primaryEndpoint: EndpointReference;
  readonly uriExpression: ReferenceExpression;
  withDataBindMount(
      source: string,
      isReadOnly?: boolean): GarnetResource;
  withDataVolume(
      name?: string,
      isReadOnly?: boolean): GarnetResource;
  withPersistence(interval?: timespan): GarnetResource;
}
```

## Properties

- `connectionStringExpression`: `ReferenceExpression` `get` -- Gets the connection string expression for the Garnet server.
- `host`: `EndpointReferenceExpression` `get` -- Gets the host endpoint reference for this resource.
- `passwordParameter`: `ParameterResource` `get` -- Gets the parameter that contains the Garnet server password.
- `port`: `EndpointReferenceExpression` `get` -- Gets the port endpoint reference for this resource.
- `primaryEndpoint`: `EndpointReference` `get` -- Gets the primary endpoint for the Garnet server.
- `uriExpression`: `ReferenceExpression` `get` -- Gets the connection URI expression for the Garnet server.

## Methods

- [withDataBindMount](/reference/api/typescript/aspire.hosting.garnet/garnetresource/withdatabindmount.md) -- `method` -- Adds a bind mount for the data folder to a Garnet container resource and enables Garnet persistence.
    ```typescript
  withDataBindMount(source: string, isReadOnly?: boolean): GarnetResource
  ```
- [withDataVolume](/reference/api/typescript/aspire.hosting.garnet/garnetresource/withdatavolume.md) -- `method` -- Adds a named volume for the data folder to a Garnet container resource and enables Garnet persistence.
    ```typescript
  withDataVolume(name?: string, isReadOnly?: boolean): GarnetResource
  ```
- [withPersistence](/reference/api/typescript/aspire.hosting.garnet/garnetresource/withpersistence.md) -- `method` -- Configures a Garnet container resource for persistence.
    ```typescript
  withPersistence(interval?: timespan): GarnetResource
  ```
