0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-28 00:46:45 +01:00
posthog/plugin-server/tests/cdp/helpers/redis.ts
2024-08-14 13:36:57 +02:00

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()
})
}