mirror of
https://github.com/PostHog/posthog.git
synced 2024-11-30 19:41:46 +01:00
13 lines
414 B
TypeScript
13 lines
414 B
TypeScript
|
import { CdpRedis } from '../../../src/cdp/redis'
|
||
|
|
||
|
export async function deleteKeysWithPrefix(redis: CdpRedis, prefix: string) {
|
||
|
await redis.useClient({ name: 'delete-keys' }, async (client) => {
|
||
|
const keys = await client.keys(`${prefix}*`)
|
||
|
const pipeline = client.pipeline()
|
||
|
keys.forEach(function (key) {
|
||
|
pipeline.del(key)
|
||
|
})
|
||
|
await pipeline.exec()
|
||
|
})
|
||
|
}
|