mirror of
https://github.com/formbricks/formbricks.git
synced 2026-04-25 20:01:53 -05:00
27 lines
468 B
TypeScript
27 lines
468 B
TypeScript
import { revalidateTag } from "next/cache";
|
|
|
|
interface RevalidateProps {
|
|
id?: string;
|
|
url?: string;
|
|
}
|
|
|
|
export const shortUrlCache = {
|
|
tag: {
|
|
byId(id: string) {
|
|
return `shortUrls-${id}`;
|
|
},
|
|
byUrl(url: string) {
|
|
return `shortUrls-byUrl-${url}`;
|
|
},
|
|
},
|
|
revalidate({ id, url }: RevalidateProps): void {
|
|
if (id) {
|
|
revalidateTag(this.tag.byId(id));
|
|
}
|
|
|
|
if (url) {
|
|
revalidateTag(this.tag.byUrl(url));
|
|
}
|
|
},
|
|
};
|