# RedisResource.WithModule

- Module: [Aspire.Hosting.Redis](/reference/api/go/aspire.hosting.redis.md)
- Defined on: [RedisResource](/reference/api/go/aspire.hosting.redis/redisresource.md)
- Version: `17.0.0`
- Kind: `method`

Configures the Redis resource to use the specified Redis module by providing its path inside the container.

## Remarks

This method passes the module path to `redis-server` as a `--loadmodule` argument. Redis resolves the path inside the
container, not on the host. To load a module built on the host machine, mount it into the Redis container first and then use
the mounted container path. Use `RedisModules` for well-known module paths that are included in the default
Redis container image.
```
var cache = builder.AddRedis("cache")
.WithModule(RedisModules.Json)
.WithModule(RedisModules.Search);
var customModuleCache = builder.AddRedis("custom-cache")
.WithBindMount("/host/redis/modules", "/redis/modules", isReadOnly: true)
.WithModule("/redis/modules/custom-module.so");
```
For more information, see the Redis module loading documentation at .

## Definition

```go
type RedisResource interface {
    // ... omitted for brevity
    WithModule(path string) RedisResource
}
```

## Signature

```go
WithModule(path string) RedisResource
```

## Parameters

- `path` (`string`) -- The absolute path to the Redis module inside the Redis container.

## Returns

[`RedisResource`](/reference/api/go/aspire.hosting.redis/redisresource.md) -- The resource builder.

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

## Defined on

- [RedisResource](/reference/api/go/aspire.hosting.redis/redisresource.md) -- `handle`
