nestjs-cache-manager-v6
v2.2.6
Published
Nest - modern, fast, powerful node.js web framework (@cache-manager)
Downloads
276
Readme
Description
cache-manager module for Nest originally published as part of the @nestjs/common
package. This package is a drop-in replacement for the deprecated CacheModule
.
Now, this module is only support cache-manager v6.
Installation
$ npm i --save nestjs-cache-manager-v6 cache-manager
Quick Start
For example @keyv/redis
$ npm i --save @keyv/redis cacheable
import { CacheModule } from 'nestjs-cache-manager-v6';
import KeyvRedis from '@keyv/redis';
import { Keyv } from 'keyv';
import { CacheableMemory } from 'cacheable';
@Module({
imports: [
CacheModule.register({
// Keyv | KeyvStoreAdapter | (Keyv | KeyvStoreAdapter)[]
stores: [
new Keyv({ store: new CacheableMemory({ ttl: 60000, lruSize: 5000 }) }),
new KeyvRedis('redis://192.168.100.1:6379'),
],
}),
],
})
export class AppModule {}
more doc visit: options
because cache-manager version 6 remove cache return interface, upgraded need use import { Cache } from 'nestjs-cache-manager-v6';
replace import { Cache } from 'cache-manager'
;