(defn$ & defnargs)
Like clojure.core/defn but supports controlling cache behaviors via metadata.
^{:ttl/threshold 5000} will cache values for 5 seconds. ^{:fifo/threshold 500} will do a sliding window of the 500 most recent invocations. ^{:lu/threshold 500} will keep 500 items and then remove items that have been accessed the least number of times. ^{:lru/threshold 500} will keep 500 items and then remove the items that have been around the longest without use.
If you specify none of the controlling attributes mentioned above, unbounded memoization will be used.
You can also provide a cache seed using metadata. The seed should be a map of argument vectors to return values.
^{:seed {[1] :value1 [2] :value2}}
Note that you can specify more than one of the above in the metadata map and the requested behaviors will compose. Composition is applied in the order you defined the keys in the map.
Like clojure.core/defn but supports controlling cache behaviors via metadata. ^{:ttl/threshold 5000} will cache values for 5 seconds. ^{:fifo/threshold 500} will do a sliding window of the 500 most recent invocations. ^{:lu/threshold 500} will keep 500 items and then remove items that have been accessed the least number of times. ^{:lru/threshold 500} will keep 500 items and then remove the items that have been around the longest without use. If you specify none of the controlling attributes mentioned above, unbounded memoization will be used. You can also provide a cache seed using metadata. The seed should be a map of argument vectors to return values. ^{:seed {[1] :value1 [2] :value2}} Note that you can specify more than one of the above in the metadata map and the requested behaviors will compose. Composition is applied in the order you defined the keys in the map.
(memo-clear! f)
(memo-clear! f args)
Like clojure.core.memoize/memo-clear! except preserves seed values.
Like clojure.core.memoize/memo-clear! except preserves seed values.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close