Refactored redis usage. Added lib/cache.

This commit is contained in:
Mike Cao 2022-11-07 22:35:51 -08:00
parent 3485b6268b
commit f118bc95c1
22 changed files with 236 additions and 221 deletions

View file

@ -32,13 +32,13 @@ function getClient() {
async function get(key) {
await connect();
return redis.get(key);
return JSON.parse(await redis.get(key));
}
async function set(key, value) {
await connect();
return redis.set(key, value);
return redis.set(key, JSON.stringify(value));
}
async function del(key) {