mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2025-01-19 09:36:47 +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},
|
{"method", (uint8_t) method},
|
||||||
{"path", path.abs()}
|
{"path", path.abs()}
|
||||||
};
|
};
|
||||||
if (auto res = fetchers::getCache()->lookup(*cacheKey)) {
|
if (auto res = fetchers::getCache()->lookup(store, *cacheKey)) {
|
||||||
StorePath storePath{fetchers::getStrAttr(*res, "storePath")};
|
|
||||||
if (store->isValidPath(storePath)) {
|
|
||||||
debug("store path cache hit for '%s'", showPath(path));
|
debug("store path cache hit for '%s'", showPath(path));
|
||||||
return storePath;
|
return res->second;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
debug("source path '%s' is uncacheable", showPath(path));
|
debug("source path '%s' is uncacheable", showPath(path));
|
||||||
|
@ -51,9 +48,7 @@ StorePath InputAccessor::fetchToStore(
|
||||||
: store->addToStoreFromDump(*source, name, method, htSHA256, repair);
|
: store->addToStoreFromDump(*source, name, method, htSHA256, repair);
|
||||||
|
|
||||||
if (cacheKey)
|
if (cacheKey)
|
||||||
fetchers::getCache()->upsert(
|
fetchers::getCache()->add(store, *cacheKey, {}, storePath, true);
|
||||||
*cacheKey,
|
|
||||||
fetchers::Attrs{{"storePath", std::string(storePath.to_string())}});
|
|
||||||
|
|
||||||
return storePath;
|
return storePath;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue