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