diff options
| author | mattpetersepic <[email protected]> | 2022-01-26 18:45:04 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-01-26 18:45:04 -0700 |
| commit | 09f2ac4d9aaea0107af8fbd6a41c2d3fe3e450ba (patch) | |
| tree | 41bc55af44f16fafa674c7e8c21d56fec7c79d53 /zenserver/upstream/upstreamcache.cpp | |
| parent | Implement SkipData,QueryLocal,StoreLocal for GET-verb CacheGet requests (#39) (diff) | |
| download | zen-09f2ac4d9aaea0107af8fbd6a41c2d3fe3e450ba.tar.xz zen-09f2ac4d9aaea0107af8fbd6a41c2d3fe3e450ba.zip | |
Implement SkipData,QueryLocal,StoreLocal for HandleRpcGetCacheRecords (#41)
* Implement SkipData,QueryLocal,StoreLocal for HandleRpcGetCacheRecords.
Diffstat (limited to 'zenserver/upstream/upstreamcache.cpp')
| -rw-r--r-- | zenserver/upstream/upstreamcache.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/zenserver/upstream/upstreamcache.cpp b/zenserver/upstream/upstreamcache.cpp index 8b02a437a..091406db3 100644 --- a/zenserver/upstream/upstreamcache.cpp +++ b/zenserver/upstream/upstreamcache.cpp @@ -1046,7 +1046,7 @@ public: virtual void GetCacheRecords(std::span<CacheKey> CacheKeys, std::span<size_t> KeyIndex, - const CacheRecordPolicy& Policy, + const CacheRecordPolicy& DownstreamPolicy, OnCacheRecordGetComplete&& OnComplete) override final { ZEN_TRACE_CPU("Upstream::GetCacheRecords"); @@ -1057,6 +1057,8 @@ public: if (m_Options.ReadUpstream) { + CacheRecordPolicy UpstreamPolicy = DownstreamPolicy.ConvertToUpstream(); + for (auto& Endpoint : m_Endpoints) { if (RemainingKeys.empty()) @@ -1075,18 +1077,19 @@ public: { metrics::OperationTiming::Scope Scope(Stats.CacheGetRequestTiming); - Result = Endpoint->GetCacheRecords(CacheKeys, RemainingKeys, Policy, [&](CacheRecordGetCompleteParams&& Params) { - if (Params.Record) - { - OnComplete(std::forward<CacheRecordGetCompleteParams>(Params)); + Result = + Endpoint->GetCacheRecords(CacheKeys, RemainingKeys, UpstreamPolicy, [&](CacheRecordGetCompleteParams&& Params) { + if (Params.Record) + { + OnComplete(std::forward<CacheRecordGetCompleteParams>(Params)); - Stats.CacheHitCount.Increment(1); - } - else - { - Missing.push_back(Params.KeyIndex); - } - }); + Stats.CacheHitCount.Increment(1); + } + else + { + Missing.push_back(Params.KeyIndex); + } + }); } Stats.CacheGetCount.Increment(int64_t(RemainingKeys.size())); |