Feat/redis fix * feat(redis): delete multiple keys in one partition scan * fix(BOOK-603): make it possible to do multiple deletes in redis at once using one partition scan Approved-by: Linus Flood
23 lines
513 B
TypeScript
23 lines
513 B
TypeScript
import { env } from "../../env/server"
|
|
|
|
export function getCacheEndpoint(key: string) {
|
|
if (!env.REDIS_API_HOST) {
|
|
throw new Error("REDIS_API_HOST is not set")
|
|
}
|
|
|
|
const url = new URL(`/api/cache`, env.REDIS_API_HOST)
|
|
url.searchParams.set("key", encodeURIComponent(key))
|
|
|
|
return url
|
|
}
|
|
|
|
export function getDeleteMultipleKeysEndpoint() {
|
|
if (!env.REDIS_API_HOST) {
|
|
throw new Error("REDIS_API_HOST is not set")
|
|
}
|
|
|
|
const url = new URL(`/api/cache/multiple`, env.REDIS_API_HOST)
|
|
|
|
return url
|
|
}
|