feat(cache): implement Redis caching layer for hot-read endpoints
Add cache-aside pattern for listing detail, search results, market analytics (4 endpoints), and user profile queries. Cache invalidation on all write mutations. Prometheus cache_hit_total/cache_miss_total metrics with resource labels. - CacheService: getOrSet, invalidate, invalidateByPrefix (SCAN-based) - TTLs: listing 5m, search 1m, market 30m, profile 10m - All 230 tests passing (13 new cache tests + 6 updated handler tests) Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -47,6 +47,18 @@ import {
|
||||
buckets: [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1],
|
||||
}),
|
||||
|
||||
// ── Cache Metrics ──
|
||||
makeCounterProvider({
|
||||
name: 'cache_hit_total',
|
||||
help: 'Total number of cache hits',
|
||||
labelNames: ['resource'],
|
||||
}),
|
||||
makeCounterProvider({
|
||||
name: 'cache_miss_total',
|
||||
help: 'Total number of cache misses',
|
||||
labelNames: ['resource'],
|
||||
}),
|
||||
|
||||
// ── Business Metrics ──
|
||||
makeCounterProvider({
|
||||
name: 'listings_created_total',
|
||||
|
||||
Reference in New Issue
Block a user