cache-manager
cache-manager copied to clipboard
Support of `[email protected]` ?
Is there an existing issue that is already proposing this?
- [X] I have searched the existing issues
Is your feature request related to a problem? Please describe it
cache-manager 6 has been released (6.1.0 as of today).
But the installation of it with @nestjs/[email protected] gives warning on potential compatibility issues:
npm warn ERESOLVE overriding peer dependency
npm warn Found: [email protected]
npm warn node_modules/cache-manager
npm warn peer cache-manager@"<=5" from @nestjs/[email protected]
npm warn node_modules/@nestjs/cache-manager
npm warn @nestjs/cache-manager@"^2.2.2" from the root project
npm warn 1 more (the root project)
npm warn
npm warn Could not resolve dependency:
npm warn peer cache-manager@"<=5" from @nestjs/[email protected]
npm warn node_modules/@nestjs/cache-manager
npm warn @nestjs/cache-manager@"^2.2.2" from the root project
Indeed, cache-manager 6 switched from cache-manager-ioredis-yet to keyv (because of being "more actively maintained and have a larger community" as the npm cache manager page says.). This may require some code update (it did inside my code), or at least on the examples.
Describe the solution you'd like
A new release of @nestjs/cache-manager which supports the cache-manager 6 package.
If that could help, here is the cache interface I needed to create to make it work on v6:
import { CacheStore } from "@nestjs/common/cache/interfaces/cache-manager.interface";
import Keyv from "keyv";
export class KeyvStore implements CacheStore {
private keyv: Keyv<any>;
constructor(keyv: Keyv<any>) {
this.keyv = keyv;
}
async get<T>(key: string): Promise<T | undefined> {
return this.keyv.get(key);
}
async set<T>(key: string, value: T, ttl?: number): Promise<void> {
await this.keyv.set(key, value, ttl);
}
async del(key: string): Promise<void> {
await this.keyv.delete(key);
}
async reset(): Promise<void> {
await this.keyv.clear();
}
}
Maybe something you like to add in @nestjs/cache-manager ?
Teachability, documentation, adoption, migration strategy
No response
What is the motivation / use case for changing the behavior?
No behavior changes