0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-25 11:17:50 +01:00
posthog/plugin-server/tests/helpers/redis.ts
2024-06-27 17:25:26 +02:00

13 lines
412 B
TypeScript

import { RedisPool } from '../../src/types'
export async function deleteKeysWithPrefix(redisPool: RedisPool, prefix: string) {
const redisClient = await redisPool.acquire()
const keys = await redisClient.keys(`${prefix}*`)
const pipeline = redisClient.pipeline()
keys.forEach(function (key) {
pipeline.del(key)
})
await pipeline.exec()
await redisPool.release(redisClient)
}