mirror of
https://github.com/PostHog/posthog.git
synced 2024-11-25 11:17:50 +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)
|
|
}
|