Drunk-Venti-Api/utils/redis.js
2022-01-15 18:07:08 +01:00

15 lines
No EOL
357 B
JavaScript

const redis = require("redis");
const client = redis.createClient("redis://localhost:6379");
client.connect();
export async function getResultFromRedis(key){
if (await client.exists(key)) {
return await client.get(key)
}
return null;
}
export async function addResultToRedis(key, value){
await client.set(key, value, {EX: 600});
}