Files
sell/middlelayer/utils/cacheKeys.ts

34 lines
851 B
TypeScript

/**
* Zentralisierte Cache-Key-Generierung
* Stellt sicher, dass Cache-Keys konsistent und wartbar sind
*/
export class CacheKeyBuilder {
static page(slug: string, locale?: string): string {
return `page:${slug}:${locale || "default"}`;
}
static pages(locale?: string): string {
return `pages:all:${locale || "default"}`;
}
static pageSeo(locale?: string): string {
return `pageSeo:${locale || "default"}`;
}
static navigation(locale?: string): string {
return `navigation:${locale || "default"}`;
}
static product(id: string): string {
return `product:${id}`;
}
static products(limit?: number): string {
return `products:${limit || "default"}`;
}
static translations(locale: string, namespace?: string): string {
return `translations:${locale}${namespace ? `:${namespace}` : ""}`;
}
}