guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/03: download: 'built-in-builders*' relies on the functional cache.


From: Ludovic Courtès
Subject: 03/03: download: 'built-in-builders*' relies on the functional cache.
Date: Mon, 26 Jun 2017 17:22:27 -0400 (EDT)

civodul pushed a commit to branch wip-build-systems-gexp
in repository guix.

commit 666d2837911e3cf4f7a2b191447af63236100ffc
Author: Ludovic Courtès <address@hidden>
Date:   Mon Jun 26 23:09:39 2017 +0200

    download: 'built-in-builders*' relies on the functional cache.
    
    The previous caching strategy, which used STORE as an 'eq?' key, would
    no longer work when the functional cache is used because subsequent
    store values are not 'eq?'.
    
    * guix/download.scm (built-in-builders*): Rewrite in terms of
    'mcached'.
---
 guix/download.scm | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/guix/download.scm b/guix/download.scm
index bed1f50..8d94eee 100644
--- a/guix/download.scm
+++ b/guix/download.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès <address@hidden>
+;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès 
<address@hidden>
 ;;; Copyright © 2013, 2014, 2015 Andreas Enge <address@hidden>
 ;;; Copyright © 2015 Federico Beffa <address@hidden>
 ;;; Copyright © 2016 Alex Griffin <address@hidden>
@@ -314,17 +314,11 @@
     (module-ref module 'gnutls)))
 
 (define built-in-builders*
-  (let ((cache (make-weak-key-hash-table)))
+  (let ((proc (store-lift built-in-builders)))
     (lambda ()
       "Return, as a monadic value, the list of built-in builders supported by
-the daemon."
-      (lambda (store)
-        ;; Memoize the result to avoid repeated RPCs.
-        (values (or (hashq-ref cache store)
-                    (let ((result (built-in-builders store)))
-                      (hashq-set! cache store result)
-                      result))
-                store)))))
+the daemon; cache the return value."
+      (mcached (proc) built-in-builders))))
 
 (define* (built-in-download file-name url
                             #:key system hash-algo hash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]