我目前正在使用 NestJS 的缓存管理器模块,我想知道为什么我无法像这样获得 NodeRedis 客户端:
constructor(
@Inject(CACHE_MANAGER) private cacheManager: Cache,
) {
cacheManager.store.getClient();
}
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
ERROR in [...].controller.ts:24:24
TS2339: Property 'getClient' does not exist on type 'Store'.
22 | @Inject(CACHE_MANAGER) private cacheManager: Cache,
23 | ) {
> 24 | cacheManager.store.getClient();
| ^^^^^^^^^
25 | }
Run Code Online (Sandbox Code Playgroud)
当我注册 CacheModule 时,我确实配置了cache-manager-redis-store,然后我想我可以获得客户端。