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

@@ -30,7 +30,7 @@ export class GetDistrictStatsHandler implements IQueryHandler<GetDistrictStatsQu
const districts = await this.marketIndexRepo.getDistrictStats(query.city, query.period);
return { city: query.city, period: query.period, districts };
},
CacheTTL.MARKET_DATA,
CacheTTL.DISTRICT_STATS,
'district_stats',
);
}

View File

@@ -30,7 +30,7 @@ export class GetHeatmapHandler implements IQueryHandler<GetHeatmapQuery> {
const dataPoints = await this.marketIndexRepo.getHeatmap(query.city, query.period);
return { city: query.city, period: query.period, dataPoints };
},
CacheTTL.MARKET_DATA,
CacheTTL.HEATMAP,
'heatmap',
);
}

View File

@@ -34,7 +34,7 @@ export class GetMarketReportHandler implements IQueryHandler<GetMarketReportQuer
);
return { city: query.city, period: query.period, districts };
},
CacheTTL.MARKET_DATA,
CacheTTL.MARKET_REPORT,
'market_report',
);
}