perf(gmw-ai): cache-hit optimization — bare-key Qdrant upsert + hit_count bump

This commit is contained in:
asepharyana
2026-08-25 12:03:47 +07:00
parent ecbf2617e4
commit 796c6390ac
4 changed files with 70 additions and 8 deletions
@@ -145,10 +145,10 @@ describe("isGloballyReusableCleanVerdict", () => {
});
it("rejects entries older than the freshness window", () => {
// Default AI_CACHE_GLOBAL_REUSE_MAX_AGE_H = 72h.
const tooOld = Date.now() - 73 * 60 * 60 * 1000;
// Default AI_CACHE_GLOBAL_REUSE_MAX_AGE_H = 120h.
const tooOld = Date.now() - 121 * 60 * 60 * 1000;
expect(isGloballyReusableCleanVerdict(makeVerdict(), tooOld)).toBe(false);
const freshEnough = Date.now() - 71 * 60 * 60 * 1000;
const freshEnough = Date.now() - 119 * 60 * 60 * 1000;
expect(isGloballyReusableCleanVerdict(makeVerdict(), freshEnough)).toBe(
true,
);