# WithModule

- Module: [Aspire.Hosting.Redis](/reference/api/go/aspire.hosting.redis.md)
- Version: `17.0.0`
- Kind: `method`
- Defined on: [`RedisResource`](/reference/api/go/aspire.hosting.redis/redisresource.md)
- Source: [GitHub](https://github.com/microsoft/aspire/tree/bcfa151cdca6d0a573f22d5d9c23f9c727cb3b2f)

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
func (RedisResource) 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()`.

## Applies to

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