We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e14f4ac commit a17987cCopy full SHA for a17987c
src/main/clojure/clojure/core/cache/wrapped.clj
@@ -85,17 +85,18 @@
85
(let [d-new-value (d-lay #(wrap-fn value-fn e))
86
hit-or-miss
87
(fn []
88
- (try
89
- (r-force (c/lookup (swap! cache-atom
90
- c/through-cache
91
- e
92
- default-wrapper-fn
93
- (fn [_] d-new-value))
94
95
- ::expired))
96
- (catch Throwable t
97
- (swap! cache-atom c/evict e)
98
- (throw t))))]
+ (locking cache-atom ; I really do not like this... :(
+ (try
+ (r-force (c/lookup (swap! cache-atom
+ c/through-cache
+ e
+ default-wrapper-fn
+ (fn [_] d-new-value))
+ ::expired))
+ (catch Throwable t
+ (swap! cache-atom c/evict e)
99
+ (throw t)))))]
100
(loop [n 0 v (hit-or-miss)]
101
(when (< n 10)
102
(if (= ::expired v)
0 commit comments