diff options
| author | Martin Ridgers <[email protected]> | 2021-10-12 14:46:10 +0200 |
|---|---|---|
| committer | Martin Ridgers <[email protected]> | 2021-10-12 14:46:10 +0200 |
| commit | 7afea60028346eaff55deaf4f4ddbd213a265e4d (patch) | |
| tree | e17d8e1d1ec2a0013df10994db28929a86189568 /zenserver/cache/structuredcache.cpp | |
| parent | Added "xmake project" output to .gitignore (diff) | |
| parent | Ratios should not be percentages (this should be done in presentation) (diff) | |
| download | zen-7afea60028346eaff55deaf4f4ddbd213a265e4d.tar.xz zen-7afea60028346eaff55deaf4f4ddbd213a265e4d.zip | |
Merged main
Diffstat (limited to 'zenserver/cache/structuredcache.cpp')
| -rw-r--r-- | zenserver/cache/structuredcache.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/zenserver/cache/structuredcache.cpp b/zenserver/cache/structuredcache.cpp index 4a2a3748a..35cb02cbb 100644 --- a/zenserver/cache/structuredcache.cpp +++ b/zenserver/cache/structuredcache.cpp @@ -161,13 +161,16 @@ HttpStructuredCacheService::HttpStructuredCacheService(ZenCacheStore& InCac , m_CidStore(InCidStore) , m_UpstreamCache(std::move(UpstreamCache)) { - StatsService.RegisterHandler("z$", *this); - StatusService.RegisterHandler("z$", *this); + m_StatsService.RegisterHandler("z$", *this); + m_StatusService.RegisterHandler("z$", *this); } HttpStructuredCacheService::~HttpStructuredCacheService() { ZEN_INFO("closing structured cache"); + + m_StatsService.UnregisterHandler("z$", *this); + m_StatusService.UnregisterHandler("z$", *this); } const char* @@ -275,6 +278,7 @@ HttpStructuredCacheService::HandleCacheRecordRequest(HttpServerRequest& Request, HandleGetCacheRecord(Request, Ref, Policy); } break; + case kPut: HandlePutCacheRecord(Request, Ref, Policy); break; @@ -883,9 +887,9 @@ HttpStructuredCacheService::HandleStatsRequest(zen::HttpServerRequest& Request) Cbo.BeginObject("cache"); Cbo << "hits" << HitCount << "misses" << MissCount; - Cbo << "hit_ratio" << (TotalCount > 0 ? (double(HitCount) / double(TotalCount) * 100.0) : 0.0); + Cbo << "hit_ratio" << (TotalCount > 0 ? (double(HitCount) / double(TotalCount)) : 0.0); Cbo << "upstream_hits" << m_CacheStats.UpstreamHitCount; - Cbo << "upstream_ratio" << (HitCount > 0 ? (double(UpstreamHitCount) / double(HitCount)) * 100.0 : 0.0); + Cbo << "upstream_ratio" << (HitCount > 0 ? (double(UpstreamHitCount) / double(HitCount)) : 0.0); Cbo.EndObject(); if (m_UpstreamCache) |