nestjs / nest

A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀
https://nestjs.com
MIT License
67.3k stars 7.59k forks source link

Hi guys, Do "Auto-caching responses" and "redis store" work together? I tried, somehow, it did not use the redis as the store still... #9498

Closed XiaoxiaYao closed 2 years ago

XiaoxiaYao commented 2 years ago

Is there an existing issue for this?

Current behavior

I am not able to see the keys storing in redis.

Minimum reproduction code

https://github.com/XiaoxiaYao/nestjs-boilerplate/tree/redis

Steps to reproduce

No response

Expected behavior

The Auto-caching responses should work with redis store. I should see the keys are stored after first time.

Package

Other package

No response

NestJS version

No response

Packages versions

{ "name": "nestjs-boilerplate", "version": "0.0.1", "description": "", "author": "", "private": true, "license": "UNLICENSED", "scripts": { "prebuild": "rimraf dist", "build": "nest build", "format": "prettier --write \"src//*.ts\" \"test/*/.ts\"", "start": "cross-env NODE_ENV=development nest start", "start:dev": "cross-env NODE_ENV=development nest start --watch", "start:debug": "cross-env NODE_ENV=development nest start --debug --watch", "start:staging": "cross-env NODE_ENV=staging node dist/main", "start:prod": "node dist/src/main", "lint": "eslint \"{src,apps,libs,test}//.ts\" --fix", "test": "jest", "test:watch": "jest --watch", "test:cov": "jest --coverage", "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", "test:e2e": "jest --config ./test/jest-e2e.json", "typeorm:dev": "cross-env NODE_ENV=development node --require ts-node/register ./node_modules/typeorm/cli.js", "typeorm:staging": "cross-env NODE_ENV=staging node --require ts-node/register ./node_modules/typeorm/cli.js", "typeorm:prod": "cross-env NODE_ENV=production node --require ts-node/register ./node_modules/typeorm/cli.js", "documentation:serve": "npx @compodoc/compodoc -p tsconfig.json --serve" }, "dependencies": { "@compodoc/compodoc": "^1.1.19", "@elastic/elasticsearch": "^7.1.0", "@nestjs/axios": "0.0.7", "@nestjs/common": "^8.0.0", "@nestjs/config": "^2.0.0", "@nestjs/core": "^8.0.0", "@nestjs/elasticsearch": "^7.1.0", "@nestjs/jwt": "^8.0.0", "@nestjs/mapped-types": "", "@nestjs/passport": "^8.2.1", "@nestjs/platform-express": "^8.0.0", "@nestjs/swagger": "^5.2.1", "@nestjs/terminus": "^8.0.6", "@nestjs/throttler": "^2.0.1", "@nestjs/typeorm": "^8.0.3", "@sendgrid/mail": "^7.6.2", "@types/multer": "^1.4.7", "@types/uuid": "^8.3.4", "bcrypt": "^5.0.1", "buffer-to-stream": "^1.0.0", "cache-manager": "^3.6.0", "cache-manager-redis-store": "^2.0.0", "class-transformer": "^0.5.1", "class-validator": "^0.13.2", "cloudinary": "^1.29.0", "cookie-parser": "^1.4.6", "cross-env": "^7.0.3", "helmet": "^5.0.2", "install": "^0.13.0", "joi": "^17.6.0", "passport": "^0.5.2", "passport-jwt": "^4.0.0", "passport-local": "^1.0.0", "pg": "^8.7.3", "reflect-metadata": "^0.1.13", "rimraf": "^3.0.2", "rxjs": "^7.2.0", "swagger-ui-express": "^4.3.0", "ts-node": "^10.0.0", "typeorm": "^0.2.45", "uuid": "^8.3.2" }, "devDependencies": { "@nestjs/cli": "^8.0.0", "@nestjs/schematics": "^8.0.0", "@nestjs/testing": "^8.0.0", "@types/bcrypt": "^5.0.0", "@types/express": "^4.17.13", "@types/jest": "27.4.0", "@types/node": "^16.0.0", "@types/passport-jwt": "^3.0.6", "@types/passport-local": "^1.0.34", "@types/supertest": "^2.0.11", "@typescript-eslint/eslint-plugin": "^5.0.0", "@typescript-eslint/parser": "^5.0.0", "eslint": "^8.0.1", "eslint-config-prettier": "^8.3.0", "eslint-plugin-prettier": "^4.0.0", "jest": "^27.2.5", "prettier": "^2.3.2", "source-map-support": "^0.5.20", "supertest": "^6.1.3", "ts-jest": "^27.0.3", "ts-loader": "^9.2.3", "tsconfig-paths": "^3.10.1", "typescript": "^4.3.5" }, "jest": { "moduleFileExtensions": [ "js", "json", "ts" ], "rootDir": "src", "testRegex": ".*\.spec\.ts$", "transform": { "^.+\.(t|j)s$": "ts-jest" }, "collectCoverageFrom": [ "*/.(t|j)s" ], "coverageDirectory": "../coverage", "testEnvironment": "node" } }

Node.js version

No response

In which operating systems have you tested?

Other

No response

jmcdo29 commented 2 years ago

The provided repository is not a minimum reproduction, there's too much there to start looking into. There should be no reason for the CacheInterceptor to not work with Redis as the cache-store. If you think this is a bug, please provide a minimum reproduction repository (Git repository/StackBlitz/CodeSandbox project). I'll reopen the issue if you do and it is actually a bug

For more direct support, please use our Discord channel (Support). We are using GitHub to track Bug Reports, Feature Requests, and Regressions.

XiaoxiaYao commented 2 years ago

Sure. I will ask in the Discord channel. Thanks.