Download redis.js from mikmc/yourbit: direct link, hf CLI and curl.
- Browser
- Download file 527 Bytes
-
https://huggingface.co/spaces/mikmc/yourbit/resolve/main/redis.js
- Command line
-
hf download hf://spaces/mikmc/yourbit/redis.js
-
curl -L -o redis.js https://huggingface.co/spaces/mikmc/yourbit/resolve/main/redis.js
527 Bytes
| const { createClient } = require("redis"); | |
| const redisClient = () => { | |
| const pass = process.env.REDIS_PASSWORD; | |
| const url = process.env.REDIS_URL; | |
| const port = process.env.REDIS_PORT; | |
| if (!pass || !url || !port) return null; | |
| const client = createClient({ | |
| url: `rediss://default:${pass}@${url}:${port}`, | |
| socket: { | |
| timeout: 10000, | |
| }, | |
| }); | |
| client.on("error", function (err) { | |
| console.log("Redis Client Error", err); | |
| return null; | |
| }); | |
| return client; | |
| }; | |
| module.exports = redisClient; | |