In our application we are using redis as a caching layer between the nodejs server and postgresql DB using sql query as key and resultset as value. To achieve this we are using
catbox-redis. Whenever a user requests a resource we check whether the sql is present in redis and return the result if present and if its not stale. Else it is fetched from DB which may in some cases take some time say 5s. The issue is before the query returns if another request with same sql is hitting the server redis is returning null since its value is not set by the previous request yet. Is there any configuration change i can make to lock the key so that till the value is set it has to go to the DB rather fetch the value from redis.