Advertisement
Guest User

redis setup

a guest
Feb 16th, 2021
1,027
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const redis = require('redis');
  2. const {promisify} = require('util');
  3. const client = redis.createClient();
  4.  
  5. client.on("error",(err)=>{
  6.     console.log(err);
  7. });
  8.  
  9. client.on("ready",()=>{
  10.     console.log("Redis connection esablished");
  11.  
  12. });
  13.  
  14. const redisClient = {
  15.     SADD: promisify(client.SADD).bind(client),
  16.     SIMEMBER: promisify(client.SISMEMBER).bind(client),
  17.     SREM: promisify(client.SREM).bind(client),
  18.     SET : promisify(client.SET).bind(client),
  19.     GET: promisify(client.get).bind(client),
  20.     HSET: promisify(client.HSET).bind(client),
  21.     HGET: promisify(client.HGET).bind(client),
  22.     DEL: promisify(client.DEL).bind(client),
  23.     EXISTS: promisify(client.EXISTS).bind(client)
  24. }
  25. module.exports = redisClient;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement