diff options
| author | Per Larsson <[email protected]> | 2021-10-01 14:45:59 +0200 |
|---|---|---|
| committer | Per Larsson <[email protected]> | 2021-10-01 14:45:59 +0200 |
| commit | be6e8143f2ea0c4acc87608f651058627b2c229c (patch) | |
| tree | f567ae8b608e7ed55b56b5deff42373349310ed2 /zenserver/cache/structuredcache.h | |
| parent | Improved error handling for upstream endpoints. (diff) | |
| download | zen-be6e8143f2ea0c4acc87608f651058627b2c229c.tar.xz zen-be6e8143f2ea0c4acc87608f651058627b2c229c.zip | |
Added cache HIT/MISS stat counters.
Diffstat (limited to 'zenserver/cache/structuredcache.h')
| -rw-r--r-- | zenserver/cache/structuredcache.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/zenserver/cache/structuredcache.h b/zenserver/cache/structuredcache.h index 47fc173e9..a360878bd 100644 --- a/zenserver/cache/structuredcache.h +++ b/zenserver/cache/structuredcache.h @@ -71,6 +71,13 @@ private: IoHash PayloadId; }; + struct CacheStats + { + std::atomic_uint64_t HitCount{}; + std::atomic_uint64_t UpstreamHitCount{}; + std::atomic_uint64_t MissCount{}; + }; + [[nodiscard]] bool ValidateKeyUri(zen::HttpServerRequest& Request, CacheRef& OutRef); void HandleCacheRecordRequest(zen::HttpServerRequest& Request, const CacheRef& Ref, CachePolicy Policy); void HandleGetCacheRecord(zen::HttpServerRequest& Request, const CacheRef& Ref, CachePolicy Policy); @@ -89,6 +96,7 @@ private: std::unique_ptr<UpstreamCache> m_UpstreamCache; uint64_t m_LastScrubTime = 0; metrics::OperationTiming m_HttpRequests; + CacheStats m_CacheStats; }; } // namespace zen |