Liking cljdoc? Tell your friends :D

cachify

Build Status codecov Clojars Project

Make your functions cached.

[net.snca/cachify "0.0.1"]

Usage

(require '[cachify.core :refer :all])

(def plus (cachify :plus (fn [a b]
                           (println a "+" b)
                           (+ a b))))

(defcachify minus
  [a b]
  (println a "-" b)
  (- a b))


(defn -main []
  (println (plus 1 2)) ; → 1 + 2
                       ;    3
  (println (plus 1 2)) ; → 3

  (println (minus 1 2)) ; → 1 - 2
                        ;    -1
  (println (minus 1 2)) ; → -1

  (perm) ; Write all caches to files
  )

License

Copyright © 2020 anekos

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close