Clean up cache key builder
#RL-003rate_reviewReview requiredmediumdev-api-team wants to merge into
main from chore/cache-key-cleanup1 file+2−8· ~6 mindev-api-team commented
buildCacheKey had a lot of parts we rarely look at. This trims it to the essentials and uses a template string for readability.
Select the changed lines that carry production risk. You can flag more than one.
0 selected for reviewsrc/lib/cacheKey.ts
+2−8check_box_outline_blankViewed
| @@ -3,10 +3,4 @@ export function buildCacheKey() | ||
| 3 | 3 | export function buildCacheKey(input) { |
| 4 | - const { tenantId, userId, resource, locale } = input; | |
| 5 | - return [ | |
| 6 | - "v2", | |
| 7 | - tenantId, | |
| 8 | - userId, | |
| 9 | - resource, | |
| 10 | - locale ?? "en", | |
| 11 | - ].join(":"); | |
| 4 | + const { resource, locale } = input; | |
| 5 | + return `cache:${resource}:${locale ?? "en"}`; | |
| 12 | 6 | } |