aboutsummaryrefslogtreecommitdiffstats
path: root/lib/redis.js
blob: 6aec2af75f2cc6397bf8267172fd740918f6ccf6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { createClient } from "redis";

const redis = createClient({
  url: "redis://rd"
});

redis.on("error", err => console.log("redis error", err));

await redis.connect();

export default redis;

export let g = async k => JSON.parse(await redis.get(k));
export let s = (k, v) => redis.set(k, JSON.stringify(v));
export let rd = redis;