From c1f04fae350acf9d72c56ef4f83037b479f25ab0 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 9 Apr 2015 11:55:36 +0200 Subject: Implement a TTL on cached fetchurl/fetchTarball results This is because we don't want to do HTTP requests on every evaluation, even though we can prevent a full redownload via the cached ETag. The default is one hour. --- src/libstore/globals.cc | 8 ++++++++ src/libstore/globals.hh | 2 ++ 2 files changed, 10 insertions(+) (limited to 'src/libstore') diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc index e382b3aac..f900fb290 100644 --- a/src/libstore/globals.cc +++ b/src/libstore/globals.cc @@ -143,6 +143,14 @@ bool Settings::get(const string & name, bool def) } +int Settings::get(const string & name, int def) +{ + int res = def; + _get(res, name); + return res; +} + + void Settings::update() { _get(tryFallback, "build-fallback"); diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh index 0230a540e..0a1072e36 100644 --- a/src/libstore/globals.hh +++ b/src/libstore/globals.hh @@ -27,6 +27,8 @@ struct Settings { bool get(const string & name, bool def); + int get(const string & name, int def); + void update(); string pack(); -- cgit v1.2.3