This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
outline/server/redis.js
2017-12-09 15:04:55 -08:00

12 lines
304 B
JavaScript

// @flow
import redis from 'redis';
import redisLock from 'redis-lock';
const client = redis.createClient(process.env.REDIS_URL);
const lock = redisLock(client);
const asyncLock = (lockName: string) =>
new Promise(resolve => lock(lockName, unlock => resolve(unlock)));
export { client, asyncLock };