# RedisResource

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

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

## Definition

```typescript
interface RedisResource
  extends IComputeResource,
    IExpressionValue,
    IManifestExpressionProvider,
    IResource,
    IResourceWithArgs,
    IResourceWithConnectionString,
    IResourceWithEndpoints,
    IResourceWithEnvironment,
    IResourceWithProbes,
    IResourceWithWaitSupport,
    IValueProvider,
    IValueWithReferences {
  readonly connectionStringExpression: ReferenceExpression;
  readonly host: EndpointReferenceExpression;
  passwordParameter: ParameterResource;
  readonly port: EndpointReferenceExpression;
  readonly primaryEndpoint: EndpointReference;
  readonly tlsEnabled: boolean;
  readonly uriExpression: ReferenceExpression;
  withDataBindMount(
      source: string,
      isReadOnly?: boolean): RedisResource;
  withDataVolume(
      name?: string,
      isReadOnly?: boolean): RedisResource;
  withHostPort(port: number): RedisResource;
  withPassword(password: ParameterResource): RedisResource;
  withPersistence(
      interval?: timespan,
      keysChangedThreshold?: number): RedisResource;
  withRedisCommander(configureContainer?: (obj: RedisCommanderResource) => Promise<void>, containerName?: string): RedisResource;
  withRedisInsight(configureContainer?: (obj: RedisInsightResource) => Promise<void>, containerName?: string): RedisResource;
}
```

## Properties

- `connectionStringExpression`: `ReferenceExpression` `get` -- Gets the connection string expression for the Redis server.
- `host`: `EndpointReferenceExpression` `get` -- Gets the host endpoint reference for this resource.
- `passwordParameter`: `ParameterResource` `get - set` -- Gets the parameter that contains the Redis server password.
- `port`: `EndpointReferenceExpression` `get` -- Gets the port endpoint reference for this resource.
- `primaryEndpoint`: `EndpointReference` `get` -- Gets the primary endpoint for the Redis server.
- `tlsEnabled`: `boolean` `get` -- Indicates whether TLS is enabled for the Redis server.
- `uriExpression`: `ReferenceExpression` `get` -- Gets the connection URI expression for the Redis server.

## Methods

- [withDataBindMount](/reference/api/typescript/aspire.hosting.redis/redisresource/withdatabindmount.md) -- `method` -- Adds a bind mount for the data folder to a Redis container resource and enables Redis persistence.
    ```typescript
  withDataBindMount(source: string, isReadOnly?: boolean): RedisResource
  ```
- [withDataVolume](/reference/api/typescript/aspire.hosting.redis/redisresource/withdatavolume.md) -- `method` -- Adds a named volume for the data folder to a Redis container resource and enables Redis persistence.
    ```typescript
  withDataVolume(name?: string, isReadOnly?: boolean): RedisResource
  ```
- [withHostPort](/reference/api/typescript/aspire.hosting.redis/redisresource/withhostport.md) -- `method` -- Configures the host port that the Redis resource is exposed on instead of using randomly assigned port.
    ```typescript
  withHostPort(port: number): RedisResource
  ```
- [withPassword](/reference/api/typescript/aspire.hosting.redis/redisresource/withpassword.md) -- `method` -- Configures the password that the Redis resource is used.
    ```typescript
  withPassword(password: ParameterResource): RedisResource
  ```
- [withPersistence](/reference/api/typescript/aspire.hosting.redis/redisresource/withpersistence.md) -- `method` -- Configures a Redis container resource for persistence.
    ```typescript
  withPersistence(interval?: timespan, keysChangedThreshold?: number): RedisResource
  ```
- [withRedisCommander](/reference/api/typescript/aspire.hosting.redis/redisresource/withrediscommander.md) -- `method` -- Adds Redis Commander management UI
    ```typescript
  withRedisCommander(configureContainer?: (obj: RedisCommanderResource) => Promise<void>, containerName?: string): RedisResource
  ```
- [withRedisInsight](/reference/api/typescript/aspire.hosting.redis/redisresource/withredisinsight.md) -- `method` -- Adds Redis Insight management UI
    ```typescript
  withRedisInsight(configureContainer?: (obj: RedisInsightResource) => Promise<void>, containerName?: string): RedisResource
  ```
