emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/dict-tree 2978fc7 024/154: ...and already a bug-fix to


From: Stefan Monnier
Subject: [elpa] externals/dict-tree 2978fc7 024/154: ...and already a bug-fix to the new cache updating code
Date: Mon, 14 Dec 2020 12:21:37 -0500 (EST)

branch: externals/dict-tree
commit 2978fc70d2e7c8ac35fd873405de45a1405db239
Author: Toby Cubitt <toby-predictive@dr-qubit.org>
Commit: tsc25 <toby-predictive@dr-qubit.org>

    ...and already a bug-fix to the new cache updating code
---
 dict-tree.el | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/dict-tree.el b/dict-tree.el
index 809dd48..f6ced34 100644
--- a/dict-tree.el
+++ b/dict-tree.el
@@ -583,7 +583,7 @@ than the corresponding CACHE-THRESHOLD (since those are 
likely to
 be the slower ones in that case). The setting 'both requires both
 conditions to be satisfied simultaneously.
 
-CACHE-UPDATE-POLICY should be a symbol ('update or 'delete),
+CACHE-UPDATE-POLICY should be a symbol ('synchronize or 'delete),
 which determines how the caches are updated when data is inserted
 or deleted. The former updates tainted cache entries, which makes
 queries faster but insertion and deleteion slower, whereas the
@@ -1059,18 +1059,18 @@ TEST returns non-nil."
 
     ;; synchronise the lookup cache if dict is a meta-dictionary,
     ;; since it's not done automatically
-    (cond
-     ;; if updating dirty cache entries...
-     ((eq (dictree-cache-update-policy dict) 'delete)
-      (when (and (dictree--meta-dict-p dict)
-                (dictree--lookup-cache-threshold dict)
-                (gethash key (dictree--lookup-cache dict)))
-       (if deleted
-           (remhash key (dictree--lookup-cache dict))
-         (puthash key newdata (dictree--lookup-cache dict)))))
-     ;; if deleting dirty cache entries...
-     (t  ; (eq (dictree-cache-update-policy dict) 'delete)
-      (remhash key (dictree-complete-cache dict))))
+    (when (and (dictree--meta-dict-p dict)
+              (dictree--lookup-cache-threshold dict))
+      (cond
+       ;; if updating dirty cache entries...
+       ((eq (dictree-cache-update-policy dict) 'synchronize)
+       (when (gethash key (dictree--lookup-cache dict))
+         (if deleted
+             (remhash key (dictree--lookup-cache dict))
+           (puthash key newdata (dictree--lookup-cache dict)))))
+       ;; if deleting dirty cache entries...
+       (t  ; (eq (dictree-cache-update-policy dict) 'delete)
+       (remhash key (dictree-complete-cache dict)))))
 
 
     ;; synchronize the completion cache, if it exists
@@ -1133,7 +1133,7 @@ TEST returns non-nil."
          (cond
 
           ;; if updating dirty cache entries...
-          ((eq (dictree-cache-update-policy dict) 'update)
+          ((eq (dictree-cache-update-policy dict) 'synchronize)
            (when (setq cache (gethash (cons prefix reverse)
                                       (dictree-complete-ranked-cache dict)))
              (setq completions (dictree--cache-completions cache))



reply via email to

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