From e7c76f7274c53a6bce87c3ae637d12743688bc0e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 14 Mar 2016 12:29:32 +0100 Subject: BinaryCacheStore::isValidPath(): Use .narinfo cache If a path is in the .narinfo cache, obviously it's valid. --- src/libstore/binary-cache-store.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/libstore') diff --git a/src/libstore/binary-cache-store.cc b/src/libstore/binary-cache-store.cc index 5ded16d028b0..94f5cbabb706 100644 --- a/src/libstore/binary-cache-store.cc +++ b/src/libstore/binary-cache-store.cc @@ -141,6 +141,15 @@ NarInfo BinaryCacheStore::readNarInfo(const Path & storePath) bool BinaryCacheStore::isValidPath(const Path & storePath) { + { + auto state_(state.lock()); + auto res = state_->narInfoCache.get(storePath); + if (res) { + stats.narInfoReadAverted++; + return true; + } + } + // FIXME: this only checks whether a .narinfo with a matching hash // part exists. So ‘f4kb...-foo’ matches ‘f4kb...-bar’, even // though they shouldn't. Not easily fixed. -- cgit 1.4.1