Connect to a Redis Database

Connect to a Redis database and run commands through that library. The library is responsible for connecting to the database. The client that must close the connection correctly. For more information access https://www.npmjs.com/package/redis

const redis = require('linkapi-sdk/state/redis');

const settings = {
  host: '',
  port: 16779,
  password: ''
};

const conn = await redis.connect(settings);

Advanced usage example:

const redis = require('linkapi-sdk/state/redis');

module.exports = async () => {
    const settings = {
        host: '',
        port: 16779,
        password: ''
    };

    let conn;

    try {
        conn = await redis.connect(settings);
        const value = await conn.get("foo");
        return value;
    } catch (err) {
        return err.message;
    } finally {
        if (conn && conn.quit) {
            await conn.quit();
        }
    }
}