0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 12:21:02 +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)
}