Taking the code below, if I repeatedly read from a cache I will occasionally get nil back from the cache. This seems to happen on my machine for ttl's under 5 ms. Although I'm sure I would never use such a short TTL in the wild, I would like to know why I am seeing this... Has anybody else noticed this issue?
(ns cache-test.core (:require [clojure.core.cache :as cache])) (def data (atom "foo")) (def ttl (atom (cache/ttl-cache-factory {} :ttl 1))) (defn get-data [] (let [c @ttl nc (if (cache/has? c {}) (cache/hit c {}) (cache/miss c {} @data))] (reset! ttl nc) (cache/lookup nc {}))) (def results (atom '())) ;; there will *sometimes* be ;; nil elements in the seq, seems dependent on cpu speed, which would make sense due to side effect of taking system/currentTimeMillis internally. (set (map (fn [_] (get-data)) (range 10000))) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.