Skip to content

Commit dee7955

Browse files
authored
fix: add default modules in createClientPool (#3088)
1 parent f33568e commit dee7955

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

packages/redis/index.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ import {
1212
RedisClusterType as genericRedisClusterType,
1313
RedisSentinelOptions,
1414
RedisSentinelType as genericRedisSentinelType,
15-
createSentinel as genericCreateSentinel
15+
createSentinel as genericCreateSentinel,
16+
createClientPool as genericCreateClientPool,
17+
RedisClientPoolType as GenericRedisClientPoolType,
18+
RedisPoolOptions,
1619
} from '@redis/client';
1720
import RedisBloomModules from '@redis/bloom';
1821
import RedisJSON from '@redis/json';
@@ -60,6 +63,23 @@ export function createClient<
6063
});
6164
}
6265

66+
export function createClientPool<
67+
M extends RedisModules,
68+
F extends RedisFunctions,
69+
S extends RedisScripts,
70+
RESP extends RespVersions,
71+
TYPE_MAPPING extends TypeMapping = {}
72+
>(clientOptions?: Omit<RedisClientOptions<M, F, S, RESP, TYPE_MAPPING>, "clientSideCache">,
73+
options?: Partial<RedisPoolOptions>): GenericRedisClientPoolType<RedisDefaultModules & M, F, S, RESP, TYPE_MAPPING> {
74+
return genericCreateClientPool({
75+
...options,
76+
modules: {
77+
...modules,
78+
...(clientOptions?.modules as M)
79+
}
80+
}, options);
81+
}
82+
6383
export type RedisClusterType<
6484
M extends RedisModules = RedisDefaultModules,
6585
F extends RedisFunctions = {},

0 commit comments

Comments
 (0)