aboutsummaryrefslogtreecommitdiff
path: root/guix/utils.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-10-17 13:02:53 +0200
committerLudovic Courtès <ludo@gnu.org>2015-10-17 14:42:01 +0200
commit739ab68bac4c5b15fee34d5938e3d7eee4735627 (patch)
tree8b4d5d40072c1b35386d9db3487017c9371ed0a6 /guix/utils.scm
parent34a7bfb049572fdf02e593ce94dde68736bd1268 (diff)
downloadguix-739ab68bac4c5b15fee34d5938e3d7eee4735627.tar
guix-739ab68bac4c5b15fee34d5938e3d7eee4735627.tar.gz
http-client: Add 'http-fetch/cached'.
* guix/utils.scm (cache-directory): New procedure. * guix/http-client.scm (%http-cache-ttl): New variable. (http-fetch/cached): New procedure.
Diffstat (limited to 'guix/utils.scm')
-rw-r--r--guix/utils.scm7
1 files changed, 7 insertions, 0 deletions
diff --git a/guix/utils.scm b/guix/utils.scm
index 0802a1b67a..190b787185 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -81,6 +81,7 @@
fold-tree
fold-tree-leaves
split
+ cache-directory
filtered-port
compressed-port
@@ -703,6 +704,12 @@ elements after E."
((head . tail)
(loop tail (cons head acc))))))
+(define (cache-directory)
+ "Return the cache directory for Guix, by default ~/.cache/guix."
+ (or (getenv "XDG_CONFIG_HOME")
+ (and=> (getenv "HOME")
+ (cut string-append <> "/.cache/guix"))))
+
;;;
;;; Source location.