node.js redis async await get

(Last Updated On: January 29, 2021)

node.js redis promise await get example

const redis = require('redis');
const { promisify } = require("util");
const redisClient = redis.createClient();
const getAsync = promisify(redisClient.get).bind(redisClient);

(async() => {
	try {
		const reply = await getAsync("mycache:13323");
		console.log(reply);
	} catch (e) {
		console.error(e);
	} 
})();