part 12 done

This commit is contained in:
QkoSad
2024-09-30 15:32:50 +03:00
parent 0a7a469d56
commit 33a5afd017
426 changed files with 46304 additions and 5 deletions
@@ -0,0 +1,27 @@
const redis = require('redis')
const { promisify } = require('util')
const { REDIS_URL } = require('../util/config')
let getAsync
let setAsync
if (!REDIS_URL) {
const redisIsDisabled = () => {
console.log('No REDIS_URL set, Redis is disabled')
return null
}
getAsync = redisIsDisabled
setAsync = redisIsDisabled
} else {
const client = redis.createClient({
url: REDIS_URL
})
getAsync = promisify(client.get).bind(client)
setAsync = promisify(client.set).bind(client)
}
module.exports = {
getAsync,
setAsync
}