const { promisify } = require('util');
const index = require('../../../index');
//get caching data in redis
const redisGet = async(key) => {
const getAsync = promisify(index.clientRedis.get).bind(index.clientRedis);
const value = await getAsync(key);
return value;
}
module.exports = redisGet;
My "redisGet" function return right value at the first time, and later times, it only return "null" although the caching data is still exist.
const cachingData = await redisGet('key');//first time: cachingData = <right value>//later times: cachingData = null
How can I fix it ?
Hope for solutions. Thanks all !