Skip to content

Commit 042a405

Browse files
committed
feat(middleware-cache): improve caching strategies & cache behavior
Signed-off-by: paulwer <paul@wer-ner.de>
1 parent d76a792 commit 042a405

15 files changed

Lines changed: 4265 additions & 79 deletions

packages/3-extensions/middleware-cache/README.md

Lines changed: 235 additions & 17 deletions
Large diffs are not rendered by default.

packages/3-extensions/middleware-cache/src/cache-annotation.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,24 @@ import { defineAnnotation } from '@prisma-next/framework-components/runtime';
1717
* **not** rehash it, so the caller is responsible for ensuring the
1818
* string is bounded in size and free of sensitive data they do not
1919
* want flowing into logs / Redis `KEYS` / persistence dumps.
20+
* - `dedupe` — Per-query toggle for in-process miss deduplication
21+
* (single-flight). When `true`, concurrent identical misses for the
22+
* same effective key in the same process share one leader execution;
23+
* followers wait for the leader's result. When `false`, each miss
24+
* executes independently.
25+
* - `tags` — Optional list of cache tags to associate with this entry.
26+
* Tags enable bulk cache invalidation: uncache by tag(s) will clear
27+
* all entries that have those tags, regardless of key pattern.
2028
*/
2129
export interface CachePayload {
30+
readonly enabled?: boolean;
2231
readonly ttl?: number;
2332
readonly skip?: boolean;
2433
readonly key?: string;
34+
readonly namespace?: string;
35+
readonly dedupe?: boolean;
36+
readonly tags?: readonly string[];
37+
readonly store?: string;
2538
}
2639

2740
/**

0 commit comments

Comments
 (0)