[Solved] hdel inside hget block nodejs redis


Since you use requests[i] as a parameter, we can assume this block of code is encapsulated in a loop: perhaps you are trying to iterate on an array and executing hget/hdel for each item.

In that case, there is a good chance you have been hit by the scoping rules of Javascript: requests[i] is part of a closure, but a closure can only be defined at the function level (not at block level).

You probably need to define an inner function, or to use forEach to iterate on your container. More information here:

nodejs, redis. check if keys exists and create new if not

For loop get items from redis delay

0

solved hdel inside hget block nodejs redis