🚀 Socket Launch Week 🚀 Day 5: Introducing Socket Fix.Learn More

nestjs-cache-manager-v6

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nestjs-cache-manager-v6

Nest - modern, fast, powerful node.js web framework (@cache-manager)

2.2.6
latest
Version published
Weekly downloads
8
14.29%
Maintainers
0
Weekly downloads
 
Created

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

FAQs

Package last updated on 04 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts