Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@ythub/nestjs-redis

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ythub/nestjs-redis

Redis(ioredis) module for NestJS framework

latest
Source
npmnpm
Version
3.0.1
Version published
Maintainers
1
Created
Source

Welcome to @liaoliaots/nestjs-redis 👋

npm (tag) npm (scoped with tag) npm GitHub code style: prettier CodeFactor Conventional Commits Maintenance workflow workflow

Redis(ioredis) module for NestJS framework.

Features 🚀

  • Support redis and cluster
  • Support health check
  • Specify single or multiple clients
  • Inject a redis/cluster client via @InjectRedis() and @InjectCluster() decorator
  • Get a redis/cluster client via RedisService and ClusterService
  • Easy to test via getRedisToken() and getClusterToken()

Documentation

For the legacy V2 or V3@next documentation, click here.

Test coverage

StatementsBranchesFunctionsLines
StatementsBranchesFunctionsLines

Install

NestJS 8:

$ npm install --save @liaoliaots/nestjs-redis ioredis
$ npm install --save-dev @types/ioredis
$ yarn add @liaoliaots/nestjs-redis ioredis
$ yarn add --dev @types/ioredis

NestJS 7:

$ npm install --save @liaoliaots/nestjs-redis@2 ioredis @nestjs/terminus@7
$ npm install --save-dev @types/ioredis
$ yarn add @liaoliaots/nestjs-redis@2 ioredis @nestjs/terminus@7
$ yarn add --dev @types/ioredis

Test a class

This package exports getRedisToken() and getClusterToken() functions that return an internal injection token based on the provided context. Using this token, you can provide a mock implementation of the redis/cluster client using any of the standard custom provider techniques, including useClass, useValue, and useFactory.

Redis

const module: TestingModule = await Test.createTestingModule({
    providers: [{ provide: getRedisToken('namespace'), useValue: mockClient }, YourService]
}).compile();

Cluster

const module: TestingModule = await Test.createTestingModule({
    providers: [{ provide: getClusterToken('namespace'), useValue: mockClient }, YourService]
}).compile();

TODO

  • select db

Package dependency overview

Author

👤 LiaoLiao

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2021 LiaoLiao.
This project is MIT licensed.

Keywords

redis

FAQs

Package last updated on 15 Sep 2021

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