feat(cache)_: add x-cache-level header

This commit is contained in:
Andrey Bocharnikov
2025-09-09 17:41:51 +04:00
parent 5e62fe5549
commit e16d707ccf
10 changed files with 342 additions and 98 deletions
@@ -43,7 +43,10 @@ func (s *Server) handleGet(w http.ResponseWriter, r *http.Request) {
Fresh: result.Fresh,
Data: result.Data,
Key: result.Key,
CacheType: result.CacheType,
TTL: result.TTL,
CacheStatus: cacheStatus,
CacheLevel: result.CacheLevel,
})
}
@@ -23,4 +23,5 @@ type CacheResponse struct {
TTL int `json:"ttl,omitempty"`
Error string `json:"error,omitempty"`
CacheStatus models.CacheStatus `json:"cache_status,omitempty"` // HIT, MISS, or BYPASS
CacheLevel models.CacheLevel `json:"cache_level,omitempty"` // L1, L2, or MISS
}