Bump Encore dep (v3.0.0)
This commit is contained in:
parent
7464f1e044
commit
421d45b3c3
4 changed files with 12 additions and 12 deletions
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
:dependencies
|
||||
[[org.clojure/tools.reader "1.3.3"]
|
||||
[com.taoensso/encore "2.127.0"]
|
||||
[com.taoensso/encore "3.0.0"]
|
||||
[org.iq80.snappy/snappy "0.4"]
|
||||
[org.tukaani/xz "1.8"]
|
||||
[org.lz4/lz4-java "1.7.1"]]
|
||||
|
|
|
|||
|
|
@ -954,7 +954,7 @@
|
|||
See also `cache`."
|
||||
[& body]
|
||||
`(try
|
||||
(.set -cache-proxy (enc/-vol! nil))
|
||||
(.set -cache-proxy (volatile! nil))
|
||||
(do ~@body)
|
||||
(finally (.remove -cache-proxy))))
|
||||
|
||||
|
|
@ -980,7 +980,7 @@
|
|||
?idx (get cache k)
|
||||
^int idx (or ?idx
|
||||
(let [idx (count cache)]
|
||||
(enc/-vol-swap! cache_ assoc k idx)
|
||||
(vswap! cache_ assoc k idx)
|
||||
idx))
|
||||
|
||||
first-occurance? (nil? ?idx)]
|
||||
|
|
@ -1023,7 +1023,7 @@
|
|||
(let [v (get @cache_ idx not-found)]
|
||||
(if (identical? v not-found)
|
||||
(let [x (thaw-from-in! in)]
|
||||
(enc/-vol-swap! cache_ assoc idx x)
|
||||
(vswap! cache_ assoc idx x)
|
||||
x)
|
||||
v))
|
||||
(throw (ex-info "No cache_ established, can't thaw. See `with-cache`."
|
||||
|
|
|
|||
|
|
@ -11,14 +11,14 @@
|
|||
;;;; Randomness
|
||||
|
||||
(do
|
||||
(defn rand-nth [coll] (nth coll (int (* (.nextDouble (enc/srng)) (count coll)))))
|
||||
(defn rand-bytes ^bytes [size] (let [ba (byte-array size)] (.nextBytes (enc/srng) ba) ba))
|
||||
(defn rand-double ^double [] (.nextDouble (enc/srng)))
|
||||
(defn rand-gauss ^double [] (.nextGaussian (enc/srng)))
|
||||
(defn rand-bool [] (.nextBoolean (enc/srng)))
|
||||
(defn rand-nth [coll] (nth coll (int (* (.nextDouble (enc/secure-rng)) (count coll)))))
|
||||
(defn rand-bytes ^bytes [size] (let [ba (byte-array size)] (.nextBytes (enc/secure-rng) ba) ba))
|
||||
(defn rand-double ^double [] (.nextDouble (enc/secure-rng)))
|
||||
(defn rand-gauss ^double [] (.nextGaussian (enc/secure-rng)))
|
||||
(defn rand-bool [] (.nextBoolean (enc/secure-rng)))
|
||||
(defn rand-long
|
||||
(^long [ ] (.nextLong (enc/srng)))
|
||||
(^long [n] (long (* (long n) (.nextDouble (enc/srng)))))))
|
||||
(^long [ ] (.nextLong (enc/secure-rng)))
|
||||
(^long [n] (long (* (long n) (.nextDouble (enc/secure-rng)))))))
|
||||
|
||||
(comment
|
||||
(seq (rand-bytes 16))
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
;; Unfortunately the only ~reliable way we can tell if something's
|
||||
;; really serializable/readable is to actually try a full roundtrip.
|
||||
|
||||
(let [swap-cache! @#'enc/-swap-cache!] ; TODO Public with newer Encore
|
||||
(let [swap-cache! enc/-swap-val!]
|
||||
(defn- memoize-type-test [test-fn]
|
||||
(let [cache (atom {})] ; {<type> <type-okay?>}
|
||||
(fn [x]
|
||||
|
|
|
|||
Loading…
Reference in a new issue