Created
April 7, 2021 18:27
-
-
Save kerolloz/091846588c74a4e6364c2f70a1e4bcfd to your computer and use it in GitHub Desktop.
Remove all keys in Redis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require("dotenv").config(); | |
const redis = require("redis"); | |
const { REDIS_URL } = process.env; | |
(async () => { | |
// connect to Redis | |
let redisClient; | |
if (REDIS_URL) { | |
redisClient = redis.createClient(REDIS_URL); | |
redisClient.on("error", (error) => { | |
console.error(error.stack); | |
process.exit(1); | |
}); | |
redisClient.once("connect", () => console.log("Redis connected!")); | |
redisClient.flushall("ASYNC", (err, suc) => console.log(err, suc)); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment