You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
环境:node:v18.14.2
npm:9.5.0
nestjs:9.2.0
"cache-manager": "^5.2.0",
"cache-manager-redis-store": "^2.0.0",
在app.module.ts中初始化缓存
import * as redisStore from 'cache-manager-redis-store';
import type { RedisClientOptions } from 'redis';
//缓存 CacheModule.register<RedisClientOptions>({ store: redisStore, host: process.env.REDIS_HOST || 'localhost', port: process.env.REDIS_PORT || 6379, auth_pass: process.env.REDIS_PWD || '', db: 14, isGlobal: true, ttl: 60, }),
这里还不能使用cache-manager-redis-store@3,会报错。
在service中注入@Inject(CACHE_MANAGER) private cacheManager: Cache
然后可以缓存成功
但是在Resolver中注入@Inject(CACHE_MANAGER) public cacheManager: Cache,
缓存使用的确实内存缓存。
有没有大佬遇到过这样的情况
Beta Was this translation helpful? Give feedback.
All reactions