# RedisResource

- Kind: `class`
- Package: [Aspire.Hosting.Redis](/reference/api/csharp/aspire.hosting.redis.md)
- Version: `13.4.0`
- Namespace: `Aspire.Hosting.ApplicationModel`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Redis/RedisResource.cs)
- Inherits: `ContainerResource`
- Implements: `IExpressionValue`, `IManifestExpressionProvider`, `IResource`, `IResourceWithConnectionString`, `IValueProvider`, `IValueWithReferences`

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

## Definition

```csharp
namespace Aspire.Hosting.ApplicationModel;

public class RedisResource
    : Aspire.Hosting.ApplicationModel.ContainerResource,
      Aspire.Hosting.ApplicationModel.IExpressionValue,
      Aspire.Hosting.ApplicationModel.IManifestExpressionProvider,
      Aspire.Hosting.ApplicationModel.IResource,
      Aspire.Hosting.ApplicationModel.IResourceWithConnectionString,
      Aspire.Hosting.ApplicationModel.IValueProvider,
      Aspire.Hosting.ApplicationModel.IValueWithReferences
{
    // ...
}
```

## ATS metadata

### ATS export

- Type ID: `Aspire.Hosting.Redis/RedisResource`

## Remarks

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

## Constructors

- [RedisResource(string)](/reference/api/csharp/aspire.hosting.redis/redisresource/constructors.md#constructor-string) -- A resource that represents a Redis resource independent of the hosting model.
- [RedisResource(string, ParameterResource)](/reference/api/csharp/aspire.hosting.redis/redisresource/constructors.md#constructor-string-parameterresource) -- Initializes a new instance of the [RedisResource](/reference/api/csharp/aspire.hosting.redis/redisresource.md) class.

## Properties

- [ConnectionStringExpression](/reference/api/csharp/aspire.hosting.redis/redisresource/properties.md#connectionstringexpression) : `ReferenceExpression` `get` -- Gets the connection string expression for the Redis server.
- [Host](/reference/api/csharp/aspire.hosting.redis/redisresource/properties.md#host) : `EndpointReferenceExpression` `get` -- Gets the host endpoint reference for this resource.
- [PasswordParameter](/reference/api/csharp/aspire.hosting.redis/redisresource/properties.md#passwordparameter) : `ParameterResource?` `get` -- Gets the parameter that contains the Redis server password.
- [Port](/reference/api/csharp/aspire.hosting.redis/redisresource/properties.md#port) : `EndpointReferenceExpression` `get` -- Gets the port endpoint reference for this resource.
- [PrimaryEndpoint](/reference/api/csharp/aspire.hosting.redis/redisresource/properties.md#primaryendpoint) : `EndpointReference` `get` -- Gets the primary endpoint for the Redis server.
- [TlsEnabled](/reference/api/csharp/aspire.hosting.redis/redisresource/properties.md#tlsenabled) : `bool` `get` -- Indicates whether TLS is enabled for the Redis server.
- [UriExpression](/reference/api/csharp/aspire.hosting.redis/redisresource/properties.md#uriexpression) : `ReferenceExpression` `get` -- Gets the connection URI expression for the Redis server.

## Methods

- [GetConnectionStringAsync(CancellationToken)](/reference/api/csharp/aspire.hosting.redis/redisresource/methods.md#getconnectionstringasync-cancellationtoken) : `ValueTask<string?>` -- Gets the connection string for the Redis server.
