From 7956e9e420ee5a2f42af6acde75fc0ccdd15fa50 Mon Sep 17 00:00:00 2001 From: NHT Date: Thu, 21 Dec 2023 16:29:08 +0700 Subject: [PATCH] fix redis config --- package.json | 1 + src/app.module.ts | 10 ++++---- yarn.lock | 61 ++++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 60 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 59a7f2a..bdcd832 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "bcrypt": "^5.1.1", "cache-manager": "^5.3.1", "cache-manager-redis-store": "^3.0.1", + "cache-manager-redis-yet": "^4.1.2", "form-data": "^4.0.0", "mysql2": "^3.6.3", "reflect-metadata": "^0.1.13", diff --git a/src/app.module.ts b/src/app.module.ts index 6ee527d..26efa70 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -10,8 +10,7 @@ import { CustomerService } from './service/customer.service'; import { TypeOrmModule } from '@nestjs/typeorm'; import { Customer } from './entity/customer.entity'; import { ConfigModule } from '@nestjs/config'; - -import * as redisStore from 'cache-manager-redis-store'; +import { redisStore } from 'cache-manager-redis-yet'; import { CacheModule } from '@nestjs/cache-manager'; @Module({ @@ -28,12 +27,11 @@ import { CacheModule } from '@nestjs/cache-manager'; autoLoadEntities: true, }), ConfigModule.forRoot(), - CacheModule.register({ + CacheModule.registerAsync({ isGlobal: true, useFactory: async () => ({ - store: redisStore as any, - host: 'localhost', - port: 6379, + store: redisStore, + url: 'redis://localhost:6379', // ttl: 1000, }), }), diff --git a/yarn.lock b/yarn.lock index 86c3124..5643541 100644 --- a/yarn.lock +++ b/yarn.lock @@ -859,7 +859,7 @@ picocolors "^1.0.0" tslib "^2.6.0" -"@redis/bloom@1.2.0": +"@redis/bloom@1.2.0", "@redis/bloom@^1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@redis/bloom/-/bloom-1.2.0.tgz#d3fd6d3c0af3ef92f26767b56414a370c7b63b71" integrity sha512-HG2DFjYKbpNmVXsa0keLHp/3leGJz1mjh09f2RLGGLQZzSHpkmZWuwJbAvo3QcRY8p80m5+ZdXZdYOSBLlp7Cg== @@ -873,22 +873,31 @@ generic-pool "3.9.0" yallist "4.0.0" -"@redis/graph@1.1.1": +"@redis/client@1.5.13", "@redis/client@^1.5.8": + version "1.5.13" + resolved "https://registry.yarnpkg.com/@redis/client/-/client-1.5.13.tgz#78786218fc1632ee4b5f7d73b8d456c95880e086" + integrity sha512-epkUM9D0Sdmt93/8Ozk43PNjLi36RZzG+d/T1Gdu5AI8jvghonTeLYV69WVWdilvFo+PYxbP0TZ0saMvr6nscQ== + dependencies: + cluster-key-slot "1.1.2" + generic-pool "3.9.0" + yallist "4.0.0" + +"@redis/graph@1.1.1", "@redis/graph@^1.1.0": version "1.1.1" resolved "https://registry.yarnpkg.com/@redis/graph/-/graph-1.1.1.tgz#8c10df2df7f7d02741866751764031a957a170ea" integrity sha512-FEMTcTHZozZciLRl6GiiIB4zGm5z5F3F6a6FZCyrfxdKOhFlGkiAqlexWMBzCi4DcRoyiOsuLfW+cjlGWyExOw== -"@redis/json@1.0.6": +"@redis/json@1.0.6", "@redis/json@^1.0.4": version "1.0.6" resolved "https://registry.yarnpkg.com/@redis/json/-/json-1.0.6.tgz#b7a7725bbb907765d84c99d55eac3fcf772e180e" integrity sha512-rcZO3bfQbm2zPRpqo82XbW8zg4G/w4W3tI7X8Mqleq9goQjAGLL7q/1n1ZX4dXEAmORVZ4s1+uKLaUOg7LrUhw== -"@redis/search@1.1.6": +"@redis/search@1.1.6", "@redis/search@^1.1.3": version "1.1.6" resolved "https://registry.yarnpkg.com/@redis/search/-/search-1.1.6.tgz#33bcdd791d9ed88ab6910243a355d85a7fedf756" integrity sha512-mZXCxbTYKBQ3M2lZnEddwEAks0Kc7nauire8q20oA0oA/LoA+E/b5Y5KZn232ztPb1FkIGqo12vh3Lf+Vw5iTw== -"@redis/time-series@1.0.5": +"@redis/time-series@1.0.5", "@redis/time-series@^1.0.4": version "1.0.5" resolved "https://registry.yarnpkg.com/@redis/time-series/-/time-series-1.0.5.tgz#a6d70ef7a0e71e083ea09b967df0a0ed742bc6ad" integrity sha512-IFjIgTusQym2B5IZJG3XKr5llka7ey84fw/NOYqESP5WUfQs9zz1ww/9+qoz4ka/S6KcGBodzlCeZ5UImKbscg== @@ -1827,6 +1836,29 @@ cache-manager-redis-store@^3.0.1: dependencies: redis "^4.3.1" +cache-manager-redis-yet@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/cache-manager-redis-yet/-/cache-manager-redis-yet-4.1.2.tgz#fa04df1a979a42585393a7a9918168978a7211ec" + integrity sha512-pM2K1ZlOv8gQpE1Z5mcDrfLj5CsNKVRiYua/SZ12j7LEDgfDeFVntI6JSgIw0siFSR/9P/FpG30scI3frHwibA== + dependencies: + "@redis/bloom" "^1.2.0" + "@redis/client" "^1.5.8" + "@redis/graph" "^1.1.0" + "@redis/json" "^1.0.4" + "@redis/search" "^1.1.3" + "@redis/time-series" "^1.0.4" + cache-manager "^5.2.2" + redis "^4.6.7" + +cache-manager@^5.2.2: + version "5.3.2" + resolved "https://registry.yarnpkg.com/cache-manager/-/cache-manager-5.3.2.tgz#a8b33ccc69323c59e1b2bdb6cc3638d902e1feda" + integrity sha512-MBpwYqCqf8LFSso5CjMs5Kj2i3RYYUP0fLwjMSnxyspYx0y8uT1SZbWiOk33fw5r+Sbpe5ERfk1+pgXEJ/omEw== + dependencies: + lodash.clonedeep "^4.5.0" + lru-cache "^10.1.0" + promise-coalesce "^1.1.2" + cache-manager@^5.3.1: version "5.3.1" resolved "https://registry.yarnpkg.com/cache-manager/-/cache-manager-5.3.1.tgz#80e4edd593b2d7f7b2b2199dc6fbb4748432bc47" @@ -4000,7 +4032,7 @@ long@^5.2.1: resolved "https://registry.npmjs.org/long/-/long-5.2.3.tgz" integrity sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q== -lru-cache@^10.0.2: +lru-cache@^10.0.2, lru-cache@^10.1.0: version "10.1.0" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.1.0.tgz#2098d41c2dc56500e6c88584aa656c84de7d0484" integrity sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag== @@ -4643,6 +4675,11 @@ promise-coalesce@^1.1.1: resolved "https://registry.yarnpkg.com/promise-coalesce/-/promise-coalesce-1.1.1.tgz#01f0d4c06060507fb0ca1f1cca8fa90ada1e22ba" integrity sha512-k7+VaIwZc5dRfSF6RELqRY1+LCmcCkrnuNV9HzIpA6iwRHKke+j9yb0LBTTHQ2RRgf6AlMl9TntuTzcgV/BZwg== +promise-coalesce@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/promise-coalesce/-/promise-coalesce-1.1.2.tgz#5d3bc4d0b2cf2e41e9df7cbeb6519b2a09459e3d" + integrity sha512-zLaJ9b8hnC564fnJH6NFSOGZYYdzrAJn2JUUIwzoQb32fG2QAakpDNM+CZo1km6keXkRXRM+hml1BFAPVnPkxg== + prompts@^2.0.1: version "2.4.2" resolved "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz" @@ -4786,6 +4823,18 @@ redis@^4.3.1: "@redis/search" "1.1.6" "@redis/time-series" "1.0.5" +redis@^4.6.7: + version "4.6.12" + resolved "https://registry.yarnpkg.com/redis/-/redis-4.6.12.tgz#b607c93e9b0dd09e641f837092e9a68cc6ac6570" + integrity sha512-41Xuuko6P4uH4VPe5nE3BqXHB7a9lkFL0J29AlxKaIfD6eWO8VO/5PDF9ad2oS+mswMsfFxaM5DlE3tnXT+P8Q== + dependencies: + "@redis/bloom" "1.2.0" + "@redis/client" "1.5.13" + "@redis/graph" "1.1.1" + "@redis/json" "1.0.6" + "@redis/search" "1.1.6" + "@redis/time-series" "1.0.5" + reflect-metadata@^0.1.13: version "0.1.13" resolved "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz"