Porting core.cache to ClojureScript
How would you like to proceed with porting core.cache to ClojureScript?
Most of the code could be shared between CLJ and CLJS, but there are differences
a) different use of macros
b) weak references - only available in some JS environments
How to proceed?
1) use reader conditionals (CLJC) to share code between CLJ and CLJS
2) have two different implementations in same codebase (like core.async does)
Option 1 would limit new core.cache version to Clojure 1.7. Second option means to maintain two different implementations.
What do you think?
Given the number of caches in the library that depend directly or indirectly on Java interop, I don't think have a CLJS version of core.cache as it stands is realistic.
I think CLJS could have a different core.cache library that contains ports of the caches that have no Java interop and could later add implementations of the other caches as desired, but whoever takes that on needs to decide whether they want a Clojure CA-based process in Contrib or a PR-based process on GitHub outside of Contrib.
I needed this feature so I searched around and found this. It seemed to be unmaintained so I forked it and gave it an update which can be found here. I've reached out to timgalebach (via an issue on his cljs-cache) to see if he wants to continue maintain or if I should take over, no response yet. All this happened before I found this thread. My implementation is following option 2 listed above, however only basic, ttl, and lru are implemented so far. Let me know if I can help.
I would like to see this a cljs port as well. I did a quick check and saw this:
Depends on internal java interop:
Depend on clojure/data.priority-map map which has java interop:
No specific java deps (for all interop there is a js equivalent):