refactor(api): improve cache service and analytics handlers

Update cache service with better error handling and analytics
query handlers to use consistent caching patterns.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-08 23:07:00 +07:00
parent 657905f7fc
commit a87532ff6e
4 changed files with 11 additions and 4 deletions

View File

@@ -12,7 +12,13 @@ export enum CacheTTL {
LISTING_DETAIL = 300, // 5 min
/** Search results — short TTL due to high variability */
SEARCH_RESULTS = 60, // 1 min
/** Market analytics — long TTL, data changes infrequently */
/** District stats — moderate TTL, invalidated on listing events */
DISTRICT_STATS = 300, // 5 min
/** Market report — moderate TTL, invalidated on listing events */
MARKET_REPORT = 900, // 15 min
/** Heatmap data — moderate TTL, invalidated on listing events */
HEATMAP = 300, // 5 min
/** Price trend — long TTL, historical data changes infrequently */
MARKET_DATA = 1800, // 30 min
/** User profile — moderate TTL, invalidated on mutation */
USER_PROFILE = 600, // 10 min
@@ -21,6 +27,7 @@ export enum CacheTTL {
export enum CachePrefix {
LISTING = 'cache:listing',
SEARCH = 'cache:search',
GEO_SEARCH = 'cache:geo_search',
MARKET_REPORT = 'cache:market:report',
MARKET_TREND = 'cache:market:trend',
MARKET_HEATMAP = 'cache:market:heatmap',