Redis
Orka uses redis under the hood. It will connect with redis if a REDIS_URL is provided. It also supports tls connections with the corresponding configuration:
// config/config.js
module.exports = {
url: 'redis://localhost:6379/',
redis: {
options: {
tls: {
ca: "",
cert: "",
key: ""
}
}};
Usage
Example:
const { getRedis } = require('@workablehr/orka');
const { promisify } = require('util');
async function demo() {
const redis = getRedis();
await promisify(redis.set.bind(redis))('key', 'some key');
await promisify(redis.get.bind(redis))('key');
}
Create custom connections
Sometimes the default connection from orka is not enough and you want to create more connections:
const { createRedisConnection } = require('@workablehr/orka');
// You could pass a different configuration here from the default connection
const connection = createRedisConnection(config.redis);