about summary refs log tree commit diff
path: root/src/libstore/globals.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-04-09T09·55+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-04-09T09·55+0200
commitc1f04fae350acf9d72c56ef4f83037b479f25ab0 (patch)
treea6f257952e49bf4077efc0a81adf5e21cfef41ac /src/libstore/globals.cc
parent60340ce3e2f793caf1704997a4d7a5a066e9ef24 (diff)
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.
Diffstat (limited to 'src/libstore/globals.cc')
-rw-r--r--src/libstore/globals.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
index e382b3aac03a..f900fb290bdb 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");