aboutsummaryrefslogtreecommitdiff
path: root/zenserver/cache/structuredcachestore.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2022-04-07 23:34:15 +0200
committerDan Engelbrecht <[email protected]>2022-04-12 22:20:47 +0200
commit5e43b80df4cf8fff6bd350139783fb15d9d25207 (patch)
tree48421b9efa7e4ee9bb75ccd308a5b98118937926 /zenserver/cache/structuredcachestore.cpp
parentcleaner GatherReferences (diff)
downloadzen-5e43b80df4cf8fff6bd350139783fb15d9d25207.tar.xz
zen-5e43b80df4cf8fff6bd350139783fb15d9d25207.zip
correct expire vs contribute
Diffstat (limited to 'zenserver/cache/structuredcachestore.cpp')
-rw-r--r--zenserver/cache/structuredcachestore.cpp19
1 files changed, 9 insertions, 10 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