diff options
| author | Per Larsson <[email protected]> | 2021-09-17 17:03:17 +0200 |
|---|---|---|
| committer | Per Larsson <[email protected]> | 2021-09-17 17:03:17 +0200 |
| commit | a4527dda7b39de637f420f458462024796c2cd14 (patch) | |
| tree | e66775ef1a399c96dc858f190180eb4b04bb3ede /zenserver/upstream/upstreamcache.cpp | |
| parent | Added cache policy tests for CbPackage. (diff) | |
| download | zen-a4527dda7b39de637f420f458462024796c2cd14.tar.xz zen-a4527dda7b39de637f420f458462024796c2cd14.zip | |
Added upstream cache policy command line option (read|write,readonly,writeonly,disabled).
Diffstat (limited to 'zenserver/upstream/upstreamcache.cpp')
| -rw-r--r-- | zenserver/upstream/upstreamcache.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/zenserver/upstream/upstreamcache.cpp b/zenserver/upstream/upstreamcache.cpp index 38d30a795..c015ef3e9 100644 --- a/zenserver/upstream/upstreamcache.cpp +++ b/zenserver/upstream/upstreamcache.cpp @@ -559,12 +559,15 @@ public: virtual GetUpstreamCacheResult GetCacheRecord(UpstreamCacheKey CacheKey, ZenContentType Type) override { - for (auto& Endpoint : m_Endpoints) + if (m_Options.ReadUpstream) { - if (GetUpstreamCacheResult Result = Endpoint->GetCacheRecord(CacheKey, Type); Result.Success) + for (auto& Endpoint : m_Endpoints) { - m_Stats.Add(*Endpoint, Result); - return Result; + if (GetUpstreamCacheResult Result = Endpoint->GetCacheRecord(CacheKey, Type); Result.Success) + { + m_Stats.Add(*Endpoint, Result); + return Result; + } } } @@ -573,12 +576,15 @@ public: virtual GetUpstreamCacheResult GetCachePayload(UpstreamPayloadKey PayloadKey) override { - for (auto& Endpoint : m_Endpoints) + if (m_Options.ReadUpstream) { - if (GetUpstreamCacheResult Result = Endpoint->GetCachePayload(PayloadKey); Result.Success) + for (auto& Endpoint : m_Endpoints) { - m_Stats.Add(*Endpoint, Result); - return Result; + if (GetUpstreamCacheResult Result = Endpoint->GetCachePayload(PayloadKey); Result.Success) + { + m_Stats.Add(*Endpoint, Result); + return Result; + } } } @@ -587,7 +593,7 @@ public: virtual EnqueueResult EnqueueUpstream(UpstreamCacheRecord CacheRecord) override { - if (m_IsRunning.load()) + if (m_IsRunning.load() && m_Options.WriteUpstream) { if (!m_UpstreamThreads.empty()) { |