Skip to content

Instantly share code, notes, and snippets.

@nkreiger
Created June 3, 2020 03:04
Show Gist options
  • Save nkreiger/20a3a05b41a4b0d55248d41fd175c97b to your computer and use it in GitHub Desktop.
Save nkreiger/20a3a05b41a4b0d55248d41fd175c97b to your computer and use it in GitHub Desktop.
const client = require('redis').createClient();
const { promisify } = require("util");
client.on('connect', () => {
console.log('Redis client connected');
});
client.on("error", (error) => {
console.error(error);
});
const get = promisify(client.get).bind(client);
const set = promisify(client.set).bind(client);
const getList = promisify(client.lrange).bind(client);
module.exports = {
get,
set,
getList
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment