1

I tried redis cache in node js code.its working fine but its throwing warring msg.how to update redis cache in node js.

Warning msg
node_redis: Deprecated: The GET command contains a "undefined" argument. This is converted to a "undefined" string now and will return an error from v.3.0 on. Please handle this in your code to make sure everything works as you intended it to.

package.json

"dependencies": {
    "express": "^4.17.0",
    "fs": "0.0.1-security",
    "joi": "^14.3.1",
    "mongodb": "^3.2.5",
    "mongodb-autoincrement": "^1.0.1",
    "nodemon": "^1.19.1",
    "querystring": "^0.2.0",
    "redis": "^2.8.0",
    "url": "^0.11.0",
    "util": "^0.12.0"
}

1 Answer 1

1

I think Its help you, You can update Redis cache by following method.

const redis = require('redis');
// create and connect redis client to local instance.
const client = redis.createClient(6379);

//key to store results in Redis store
const redisKey = 'user:data';

client.setex(redisKey, 3600, JSON.stringify({name: "Jelly Fish"}));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.