diff --git a/src/metabase/lib/cache.cljc b/src/metabase/lib/cache.cljc index 7f5d27e0a5cd7ca089d80f7fe90e26c5db09dbc1..ec573c0ec603ce79a18426e039c5f3661e5b8689 100644 --- a/src/metabase/lib/cache.cljc +++ b/src/metabase/lib/cache.cljc @@ -17,21 +17,12 @@ (do (when-not (.-__mbcache ^js x) (set! (.-__mbcache ^js x) (atom {}))) - (when-not js/window.__mbcache_stats - (set! js/window.__mbcache_stats (js-obj))) (if-let [cache (.-__mbcache ^js x)] (if-let [cached (get @cache subkey)] - (do - (if-let [^js stats (aget js/window.__mbcache_stats subkey)] - (set! (.-hits stats) (inc (.-hits stats))) - (aset js/window.__mbcache_stats subkey (js-obj "hits" 1 "misses" 0))) - cached) + cached ;; Cache miss - generate the value and cache it. (let [value (f x)] (swap! cache assoc subkey value) - (if-let [^js stats (aget js/window.__mbcache_stats subkey)] - (set! (.-misses stats) (inc (.-misses stats))) - (aset js/window.__mbcache_stats subkey (js-obj "hits" 0 "misses" 1))) value)) (f x))) (f x))))