{"_id":"@1874w/nestjs-ioredis","_rev":"1-382760bfdba0865e0d1ac63b0310180c","name":"@1874w/nestjs-ioredis","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@1874w/nestjs-ioredis","version":"1.0.0","keywords":["nest","nestjs","nest-modules","nestjs-modules","redis","ioredis"],"author":{"name":"LetTTGACO"},"license":"MIT","_id":"@1874w/nestjs-ioredis@1.0.0","maintainers":[{"name":"letttgaco","email":"angrycat2333@gmail.com"}],"homepage":"https://github.com/LetTTGACO/ioredis#readme","bugs":{"url":"https://github.com/LetTTGACO/ioredis/issues"},"dist":{"shasum":"784822fe7e8893565af8735c3e49cd5030c270e8","tarball":"https://registry.npmjs.org/@1874w/nestjs-ioredis/-/nestjs-ioredis-1.0.0.tgz","fileCount":42,"integrity":"sha512-L4F+YQEGa3O3aRt2YKsRAqG56UtgvTIAz76ZJFM7ie75Nq7PFSZnaB/bwZIxKgEuZpaJxhlje8FDLMkdpIj97w==","signatures":[{"sig":"MEUCIQDZl+rd3RIbDl6WWdxZ/cx3vAQeGAkEz/lmOKtJ58gDVAIgQO5cwk2G0Q72fd7llg9KRK656WJws+M5WHE0yTNbN9Q=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":34283},"husky":{"hooks":{"commit-msg":"commitlint -c .commitlintrc.json -E HUSKY_GIT_PARAMS","pre-commit":"lint-staged"}},"types":"./index.d.ts","gitHead":"ba05d6de84e7fcdcbed34be0423496d3d61569a4","private":false,"scripts":{"test":"jest","build":"tsc -p tsconfig.json","major":"npm run release -- --release-as major","minor":"npm run release -- --release-as minor","patch":"npm run release -- --release-as patch","deploy":"sh ./publish.sh","format":"prettier **/**/*.ts --ignore-path ./.prettierignore --write","release":"standard-version","prebuild":"rimraf dist"},"_npmUser":{"name":"letttgaco","email":"angrycat2333@gmail.com"},"repository":{"url":"git+https://github.com/LetTTGACO/ioredis.git","type":"git"},"_npmVersion":"10.5.2","description":"Nest - a ioredis module (@ioredis). depend on @nestjs-modules/ioredis and support nestjs v11","directories":{},"lint-staged":{"*.ts":["prettier --write"]},"_nodeVersion":"20.13.1","_hasShrinkwrap":false,"devDependencies":{"jest":"29.7.0","husky":"8.0.3","tslib":"2.6.2","rimraf":"5.0.5","ioredis":"5.5.0","ts-jest":"29.1.1","ts-node":"10.9.2","prettier":"3.1.1","typescript":"5.3.3","@types/jest":"29.5.11","lint-staged":"15.2.0","@nestjs/core":"11.0.10","@nestjs/common":"11.0.10","@nestjs/testing":"11.0.10","@nestjs/terminus":"11.0.0","reflect-metadata":"0.2.2","standard-version":"9.5.0","@nestjs/platform-express":"11.0.10","@typescript-eslint/parser":"6.15.0","@typescript-eslint/eslint-plugin":"6.15.0"},"peerDependencies":{"ioredis":">=5.0.0","@nestjs/core":">=6.7.0","@nestjs/common":">=6.7.0"},"optionalDependencies":{"@nestjs/terminus":"11.0.0"},"_npmOperationalInternal":{"tmp":"tmp/nestjs-ioredis_1.0.0_1739824258939_0.8464946387432208","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@1874w/nestjs-ioredis","version":"1.0.1","description":"Nest - a ioredis module (@ioredis). depend on @nestjs-modules/ioredis and support nestjs v11","author":{"name":"LetTTGACO"},"private":false,"license":"MIT","scripts":{"prebuild":"rimraf dist","build":"tsc -p tsconfig.json","format":"prettier **/**/*.ts --ignore-path ./.prettierignore --write","test":"jest","release":"standard-version","patch":"npm run release -- --release-as patch","minor":"npm run release -- --release-as minor","major":"npm run release -- --release-as major","deploy":"sh ./publish.sh"},"keywords":["nest","nestjs","nest-modules","nestjs-modules","redis","ioredis"],"peerDependencies":{"@nestjs/common":">=6.7.0","@nestjs/core":">=6.7.0","ioredis":">=5.0.0"},"optionalDependencies":{"@nestjs/terminus":"11.0.0"},"devDependencies":{"@nestjs/common":"11.0.10","@nestjs/core":"11.0.10","@nestjs/platform-express":"11.0.10","@nestjs/terminus":"11.0.0","@nestjs/testing":"11.0.10","@types/jest":"29.5.11","@typescript-eslint/eslint-plugin":"6.15.0","@typescript-eslint/parser":"6.15.0","husky":"8.0.3","ioredis":"5.5.0","jest":"29.7.0","lint-staged":"15.2.0","prettier":"3.1.1","reflect-metadata":"0.2.2","rimraf":"5.0.5","standard-version":"9.5.0","ts-jest":"29.1.1","ts-node":"10.9.2","tslib":"2.6.2","typescript":"5.3.3"},"lint-staged":{"*.ts":["prettier --write"]},"husky":{"hooks":{"commit-msg":"commitlint -c .commitlintrc.json -E HUSKY_GIT_PARAMS","pre-commit":"lint-staged"}},"repository":{"type":"git","url":"git+https://github.com/LetTTGACO/ioredis.git"},"_id":"@1874w/nestjs-ioredis@1.0.1","gitHead":"12f398366dac064bdff7bac94d51c37259403972","types":"./index.d.ts","bugs":{"url":"https://github.com/LetTTGACO/ioredis/issues"},"homepage":"https://github.com/LetTTGACO/ioredis#readme","_nodeVersion":"20.13.1","_npmVersion":"10.5.2","dist":{"integrity":"sha512-h7ATq0lVWtxiq+eVtu4lOClMhayrbGTEs7jAgedd5sfQp1UGNbe7+uLSLXpLIb4AJi/QwNvhmp/cxxoPfnmNJw==","shasum":"5ba409d69d957cccf4aa2eef8eedc6e9a4ec83ad","tarball":"https://registry.npmjs.org/@1874w/nestjs-ioredis/-/nestjs-ioredis-1.0.1.tgz","fileCount":31,"unpackedSize":26377,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIG7OmdmOAst7RObybm14eHKFsRY3yVzGCxD0UbdRZ2sWAiEAvGXZ2azoQ2Nv+uWGxW8HsF0GQxGLqv3FV6vzen+k6Hk="}]},"_npmUser":{"name":"letttgaco","email":"angrycat2333@gmail.com"},"directories":{},"maintainers":[{"name":"letttgaco","email":"angrycat2333@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/nestjs-ioredis_1.0.1_1739824621799_0.8404092970111949"},"_hasShrinkwrap":false}},"time":{"created":"2025-02-17T20:30:58.820Z","modified":"2025-02-17T20:37:02.220Z","1.0.0":"2025-02-17T20:30:59.119Z","1.0.1":"2025-02-17T20:37:02.003Z"},"bugs":{"url":"https://github.com/LetTTGACO/ioredis/issues"},"author":{"name":"LetTTGACO"},"license":"MIT","homepage":"https://github.com/LetTTGACO/ioredis#readme","keywords":["nest","nestjs","nest-modules","nestjs-modules","redis","ioredis"],"repository":{"type":"git","url":"git+https://github.com/LetTTGACO/ioredis.git"},"description":"Nest - a ioredis module (@ioredis). depend on @nestjs-modules/ioredis and support nestjs v11","maintainers":[{"name":"letttgaco","email":"angrycat2333@gmail.com"}],"readme":"<p align=\"center\">\n  <a href=\"http://nestjs.com/\" target=\"blank\">\n    <img src=\"https://nestjs.com/img/logo_text.svg\" width=\"320\" alt=\"Nest Logo\" />\n  </a>\n</p>\n\n<p align=\"center\">\n  A ioredis module for Nest framework (node.js) using <a href=\"https://github.com/luin/ioredis\">ioredis</a> library.\n</p>\n<p align=\"center\">depend on <a href=\"https://github.com/nest-modules/ioredis\">nest-modules/ioredis</a> and support nestjs v11</p>\n\n<p align=\"center\">\n  <a href=\"https://www.npmjs.com/org/@1874w/nestjs-ioredis\"><img src=\"https://img.shields.io/npm/v/@1874w/nestjs-ioredis.svg\" alt=\"NPM Version\" /></a>\n  <a href=\"https://www.npmjs.com/org/@1874w/nestjs-ioredis\"><img src=\"https://img.shields.io/npm/l/@1874w/nestjs-ioredis.svg\" alt=\"Package License\" /></a>\n  <a href=\"https://www.npmjs.com/org/@1874w/nestjs-ioredis\"><img src=\"https://img.shields.io/npm/dm/@1874w/nestjs-ioredis.svg\" alt=\"NPM Downloads\" /></a>\n</p>\n\n### Prerequisites\nThis lib requires Node.js >=20, NestJS ^11.0.0, ioredis ^5.0.0.\n\n### Installation\n\n#### with npm\n```sh\nnpm install --save @1874w/nestjs-ioredis ioredis\n```\n\n#### with yarn\n```sh\nyarn add @1874w/nestjs-ioredis ioredis\n```\n\n#### with pnpm\n```sh\npnpm i @1874w/nestjs-ioredis ioredis\n```\n\n### How to use?\n\n#### RedisModule.forRoot(options, connection?)\n\n##### Single Type (forRoot)\n\n```ts\nimport { Module } from '@nestjs/common';\nimport { RedisModule } from '@1874w/nestjs-ioredis';\nimport { AppController } from './app.controller';\n\n@Module({\n  imports: [\n    RedisModule.forRoot({\n      type: 'single',\n      url: 'redis://localhost:6379',\n      options: {\n        password: '123456'\n      },\n    }),\n  ],\n  controllers: [AppController],\n})\nexport class AppModule {}\n```\n\n##### Cluster Type (forRoot)\n\n```ts\nimport { Module } from '@nestjs/common';\nimport { RedisModule } from '@1874w/nestjs-ioredis';\nimport { AppController } from './app.controller';\n\n@Module({\n  imports: [\n    RedisModule.forRoot({\n      type: 'cluster',\n      nodes: [\n        {\n          host: '127.0.0.1',\n          port: 6379\n        },\n        {\n          host: '127.0.0.2',\n          port: 6379\n        }\n      ],\n      options: {\n        redisOptions: {\n          password: '123456'\n        }\n      }\n    }),\n  ],\n  controllers: [AppController],\n})\nexport class AppModule {}\n```\n\n#### RedisModule.forRootAsync(options, connection?)\n\n##### Single Type (forRootAsync)  \n\n```ts\nimport { Module } from '@nestjs/common';\nimport { RedisModule } from '@1874w/nestjs-ioredis';\nimport { AppController } from './app.controller';\n\n@Module({\n  imports: [\n    RedisModule.forRootAsync({\n      useFactory: () => ({\n        type: 'single',\n        url: 'redis://localhost:6379',\n        options: {\n          password: '123456',\n        },\n      }),\n    }),\n  ],\n  controllers: [AppController],\n})\nexport class AppModule {}\n```\n\n##### Cluster Type (forRootAsync)  \n\n```ts\nimport { Module } from '@nestjs/common';\nimport { RedisModule } from '@1874w/nestjs-ioredis';\nimport { AppController } from './app.controller';\n\n@Module({\n  imports: [\n    RedisModule.forRootAsync({\n      useFactory: () => ({\n        type: 'cluster',\n        nodes: [\n          {\n            host: '127.0.0.1',\n            port: 6379\n          },\n            {\n            host: '127.0.0.2',\n            port: 6379\n          }\n        ],\n        options: {\n          redisOptions: {\n            password: '123456'\n          }\n        }\n      }),\n    }),\n  ],\n  controllers: [AppController],\n})\nexport class AppModule {}\n```\n\n#### InjectRedis(connection?)\n\n```ts\nimport Redis from 'ioredis';\nimport { Controller, Get } from '@nestjs/common';\nimport { InjectRedis } from '@1874w/nestjs-ioredis';\n\n@Controller()\nexport class AppController {\n  constructor(\n    @InjectRedis() private readonly redis: Redis,\n  ) {}\n\n  @Get()\n  async getHello() {\n    await this.redis.set('key', 'Redis data!');\n    const redisData = await this.redis.get(\"key\");\n    return { redisData };\n  }\n}\n```\n\n#### How to use the Redis indicator for the Terminus library?\"\n\n```js\n//health.module.ts\nimport { Module } from '@nestjs/common';\nimport { TerminusModule } from '@nestjs/terminus';\nimport { RedisHealthModule, } from '@1874w/nestjs-ioredis';\n\n@Module({\n  imports: [TerminusModule, RedisHealthModule],\n  controllers: [HealthController]\n})\nexport class HealthModule {}\n```\n\n```js\n//health.controller.ts\nimport { Controller, Get } from '@nestjs/common';\nimport {\n  HealthCheckService,\n  HealthCheck,\n  HealthCheckResult\n} from '@nestjs/terminus';\nimport { RedisHealthIndicator } from './redis.health';\n\n@Controller('health')\nexport class HealthController {\n  constructor(\n    private health: HealthCheckService,\n    private redis: RedisHealthIndicator,\n  ) {}\n\n  @Get()\n  @HealthCheck()\n  check(): Promise<HealthCheckResult> {\n    return this.health.check([\n      async () => this.redis.isHealthy('redis'),\n    ]);\n  }\n}\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}