That's probably a good idea. I wrote a helper function to abstract away the details:
(defn build-helper [cache-factory f base & args]
(build-memoizer
#(PluggableMemoization. %1 (apply cache-factory %2 %3))
f
(derefable-seed base)
args))
The memo implementation then becomes (sans docs)
(defn memo
([f] (memo f {}))
([f seed]
(build-helper cache/basic-cache-factory f seed)))
and my earlier lru-ttl-memo function simplifies to
(def lru-ttl-memo
(partial memo/build-helper lru-ttl-cache))
Definitely a huge gain in simplicity, and agnostic of implementation details.
Diff at
https://github.com/john-shaffer/core.memoize/commit/669febe3af7f325de43cab82ab7d09469fd148a1
I really have no idea how you run the tests normally. I had to symlink the code into a leiningen project, hot-patch it, and call clojure.test/run-tests.