mirror of
https://github.com/graphql-hive/console
synced 2026-04-21 14:37:17 +00:00
22 lines
454 B
TypeScript
22 lines
454 B
TypeScript
/* eslint-disable import/no-extraneous-dependencies */
|
|
import Redis from 'ioredis';
|
|
|
|
export const resetRedis = async (conn: {
|
|
host: string;
|
|
port: number;
|
|
password: string;
|
|
}) => {
|
|
const redis = new Redis({
|
|
host: conn.host,
|
|
port: conn.port,
|
|
password: conn.password,
|
|
db: 0,
|
|
maxRetriesPerRequest: 5,
|
|
enableReadyCheck: true,
|
|
});
|
|
|
|
const keys = await redis.keys('*');
|
|
if (keys?.length) {
|
|
await redis.del(keys);
|
|
}
|
|
};
|