nestjs-cache-manager-v6
TypeScript icon, indicating that this package has built-in type declarations

2.2.6 • Public • Published

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads Coverage Discord Backers on Open Collective Sponsors on Open Collective

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';

Readme

Keywords

none

Package Sidebar

Install

npm i nestjs-cache-manager-v6

Weekly Downloads

1

Version

2.2.6

License

MIT

Unpacked Size

34.5 kB

Total Files

43

Last publish

Collaborators

  • zhx47