1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 19:01:16 +02:00

Test the NAR info cache

This commit is contained in:
Eelco Dolstra 2016-05-30 14:53:57 +02:00
parent 3593c8285d
commit bac123ddd9
6 changed files with 25 additions and 29 deletions

View file

@ -1,5 +1,6 @@
#include "binary-cache-store.hh"
#include "globals.hh"
#include "nar-info-disk-cache.hh"
namespace nix {
@ -16,6 +17,9 @@ public:
: BinaryCacheStore(params)
, binaryCacheDir(binaryCacheDir)
{
/* For testing the NAR info cache. */
if (getEnv("_NIX_CACHE_FILE_URLS") == "1")
diskCache = getNarInfoDiskCache();
}
void init() override;
@ -53,6 +57,9 @@ void LocalBinaryCacheStore::init()
{
createDirs(binaryCacheDir + "/nar");
BinaryCacheStore::init();
if (diskCache && !diskCache->cacheExists(getUri()))
diskCache->createCache(getUri(), wantMassQuery_, priority);
}
static void atomicWrite(const Path & path, const std::string & s)