mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
Use the StorePath-based cache interface
This commit is contained in:
parent
61b76f5f34
commit
b1ab592f28
1 changed files with 4 additions and 9 deletions
|
@ -26,12 +26,9 @@ StorePath InputAccessor::fetchToStore(
|
|||
{"method", (uint8_t) method},
|
||||
{"path", path.abs()}
|
||||
};
|
||||
if (auto res = fetchers::getCache()->lookup(*cacheKey)) {
|
||||
StorePath storePath{fetchers::getStrAttr(*res, "storePath")};
|
||||
if (store->isValidPath(storePath)) {
|
||||
debug("store path cache hit for '%s'", showPath(path));
|
||||
return storePath;
|
||||
}
|
||||
if (auto res = fetchers::getCache()->lookup(store, *cacheKey)) {
|
||||
debug("store path cache hit for '%s'", showPath(path));
|
||||
return res->second;
|
||||
}
|
||||
} else
|
||||
debug("source path '%s' is uncacheable", showPath(path));
|
||||
|
@ -51,9 +48,7 @@ StorePath InputAccessor::fetchToStore(
|
|||
: store->addToStoreFromDump(*source, name, method, htSHA256, repair);
|
||||
|
||||
if (cacheKey)
|
||||
fetchers::getCache()->upsert(
|
||||
*cacheKey,
|
||||
fetchers::Attrs{{"storePath", std::string(storePath.to_string())}});
|
||||
fetchers::getCache()->add(store, *cacheKey, {}, storePath, true);
|
||||
|
||||
return storePath;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue