# ValkeyResource

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

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

## Definition

```typescript
interface ValkeyResource
  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): ValkeyResource;
  withDataVolume(
      name?: string,
      isReadOnly?: boolean): ValkeyResource;
  withPersistence(
      interval?: timespan,
      keysChangedThreshold?: number): ValkeyResource;
}
```

## Properties

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

## Methods

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