feat(api): add Redis caching for user quota and improve cache invalidation

Add 1-min TTL caching to CheckQuotaHandler (previously uncached, hitting
3 DB queries per guarded request). Add cache invalidation to
MeterUsageHandler and UpgradeSubscriptionHandler so quota caches stay
fresh after usage metering and plan changes. Increase search results TTL
from 1min to 2min per spec. Add market cache invalidation on listing
creation to keep district stats and market reports consistent.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-09 01:11:40 +07:00
parent 62f4f001b6
commit 05651ba4c3
10 changed files with 119 additions and 11 deletions

View File

@@ -63,7 +63,7 @@ describe('GeoSearchHandler', () => {
expect(mockCache.getOrSet).toHaveBeenCalledWith(
expect.stringContaining('cache:geo_search:'),
expect.any(Function),
60,
120,
'geo_search',
);
});