(cachify func-name func & {:keys [ttl] :or {ttl (tm/seconds 60)}})
Returns the function with a cache
e.g. (defn plus [a b] (println a "+" b) (+ a b)) (def cached-plus (cachify :plus plus)) (cached-plus 1 2) ; print "1 + 2" and return 3 (cached-plus 1 2) ; return 3
Returns the function with a cache e.g. (defn plus [a b] (println a "+" b) (+ a b)) (def cached-plus (cachify :plus plus)) (cached-plus 1 2) ; print "1 + 2" and return 3 (cached-plus 1 2) ; return 3
(defcachify name & body)
Define cachified function
e.g. (defcachify plus [a b] (println a "+" b) (+ a b)) (cached-plus 1 2) ; print "1 + 2" and return 3 (cached-plus 1 2) ; return 3
Define cachified function e.g. (defcachify plus [a b] (println a "+" b) (+ a b)) (cached-plus 1 2) ; print "1 + 2" and return 3 (cached-plus 1 2) ; return 3
(perm)
(perm caches)
Write caches to files
e.g. (defcachify plus [a b] (+ a b)) (defn -main [] (println (plus 1 2)) (println (plus 1 2)) ; ... (perm)
Write caches to files e.g. (defcachify plus [a b] (+ a b)) (defn -main [] (println (plus 1 2)) (println (plus 1 2)) ; ... (perm)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close