0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-30 19:41:46 +01:00
posthog/plugin-server/tests/cdp/helpers/redis.ts

13 lines
414 B
TypeScript
Raw Normal View History

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