Skip to content

Instantly share code, notes, and snippets.

Avatar
👋
Hey! Hope you're having an awesome day :-)

Peter Taoussanis ptaoussanis

👋
Hey! Hope you're having an awesome day :-)
View GitHub Profile
@ptaoussanis
ptaoussanis / smart_memoize.clj
Created Jun 14, 2012
More powerful memoize for Clojure
View smart_memoize.clj
(def ^:private gc-sm-cache!
"Maintains maximum cache size by intelligently pruning less valuable items."
(let [gc-running? (atom false)]
(fn [cache ttl max-items now]
(when-not @gc-running?
(reset! gc-running? true)
(let [snapshot @cache
You can’t perform that action at this time.