fix: get or create cached full customer overwrites previous cache on set

This commit is contained in:
John Yeo
2026-01-19 11:17:14 +00:00
parent 244e41ed83
commit 182492f752
15 changed files with 220 additions and 135 deletions

View File

@@ -76,6 +76,15 @@ export const DELETE_FULL_CUSTOMER_CACHE_SCRIPT = readFileSync(
"utf-8",
);
/**
* Lua script for setting a FullCustomer cache in Redis.
* Checks stale-write guard, checks if cache exists, and sets cache atomically.
*/
export const SET_FULL_CUSTOMER_CACHE_SCRIPT = readFileSync(
join(DELETE_CACHE_DIR, "setFullCustomerCache.lua"),
"utf-8",
);
/**
* Lua script for batch deleting multiple FullCustomer caches from Redis.
* For each customer: checks test guard, sets stale-write guard, deletes cache.