import redis from 'redis';


export class RedisClient {

    client;

    constructor() {
        this.client = redis.createClient({
            host: process.env.REDIS_DB,
            port: 6379,
        });

        this.client.on('error', err => {
            console.log('Error ' + err);
        });
    }

    async get(key, callback){
        return this.client.get(key, callback);
    }

    async set(key, value, callback){
        return this.client.set(key, value, callback);
    }

    async del(key, callback) {
        return this.client.del(key, callback);
    }


}

export const redisClient = new RedisClient();
