aboutsummaryrefslogtreecommitdiff
path: root/zenserver/cache
diff options
context:
space:
mode:
Diffstat (limited to 'zenserver/cache')
-rw-r--r--zenserver/cache/structuredcachestore.cpp19
-rw-r--r--zenserver/cache/structuredcachestore.h4
2 files changed, 12 insertions, 11 deletions
diff --git a/zenserver/cache/structuredcachestore.cpp b/zenserver/cache/structuredcachestore.cpp
index 5c71ad7bb..d28964502 100644
--- a/zenserver/cache/structuredcachestore.cpp
+++ b/zenserver/cache/structuredcachestore.cpp
@@ -1694,21 +1694,20 @@ ZenCacheDiskLayer::CacheBucket::GatherReferences(GcContext& GcCtx)
std::vector<IoHash> ExpiredKeys;
ExpiredKeys.reserve(1024);
+
+ std::vector<IoHash> Cids;
+ Cids.reserve(1024);
+
for (const auto& Entry : Index)
{
+ const IoHash& Key = Entry.first;
if (Entry.second.LastAccess < ExpireTicks)
{
- ExpiredKeys.push_back(Entry.first);
+ ExpiredKeys.push_back(Key);
+ continue;
}
- }
- std::vector<IoHash> Cids;
- Cids.reserve(1024);
-
- for (const auto& Key : ExpiredKeys)
- {
- IndexEntry& Entry = Index[Key];
- const DiskLocation& Loc = Entry.Location;
+ const DiskLocation& Loc = Entry.second.Location;
if (Loc.IsFlagSet(DiskLocation::kStructured))
{
@@ -1743,7 +1742,7 @@ ZenCacheDiskLayer::CacheBucket::GatherReferences(GcContext& GcCtx)
}
GcCtx.ContributeCids(Cids);
- GcCtx.ContributeCacheKeys(m_BucketName, {}, std::move(ExpiredKeys));
+ GcCtx.ContributeCacheKeys(m_BucketName, std::move(ExpiredKeys));
}
void
diff --git a/zenserver/cache/structuredcachestore.h b/zenserver/cache/structuredcachestore.h
index 8e8b6ee78..c107983b5 100644
--- a/zenserver/cache/structuredcachestore.h
+++ b/zenserver/cache/structuredcachestore.h
@@ -271,7 +271,9 @@ private:
IndexEntry() : Location(), LastAccess() {}
IndexEntry(const DiskLocation& Loc, const int64_t Timestamp) : Location(Loc), LastAccess(Timestamp) {}
IndexEntry(const IndexEntry& E) : Location(E.Location), LastAccess(E.LastAccess.load(std::memory_order_relaxed)) {}
- IndexEntry(IndexEntry&& E) : Location(std::move(E.Location)), LastAccess(E.LastAccess.load(std::memory_order_relaxed)) {}
+ IndexEntry(IndexEntry&& E) noexcept : Location(std::move(E.Location)), LastAccess(E.LastAccess.load(std::memory_order_relaxed))
+ {
+ }
IndexEntry& operator=(const IndexEntry& E) { return *this = IndexEntry(E); }
IndexEntry& operator=(IndexEntry&& E) noexcept