Skip to content

Instantly share code, notes, and snippets.

@kerolloz
Created April 7, 2021 18:27
Show Gist options
  • Save kerolloz/091846588c74a4e6364c2f70a1e4bcfd to your computer and use it in GitHub Desktop.
Save kerolloz/091846588c74a4e6364c2f70a1e4bcfd to your computer and use it in GitHub Desktop.
Remove all keys in Redis
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