I am new in the JS world, I am creating a query cache and I decide to use redis
to cache the information, but I want to know if there is a way to use async/await keywords on the get function of redis
.
const redis = require('redis');
const redisUrl = 'redis://127.0.0.1:6379';
const client = redis.createClient(redisUrl);
client.set('colors',JSON.stringify({red: 'rojo'}))
client.get('colors', (err, value) => {
this.values = JSON.parse(value)
})
I want to know if I can use the await keyword instead of a callback function in the get function.
client.get
supposed to be belowconst client
? – Obsolesce