https://gist.github.com/rwat/4abcebcb4cfae956f382
I've enjoyed using clojure.core.cache for caching results from time expensive operations involving I/O, etc. and feel like this is the sort of function that makes c.c.cache as simple to use as possible. e.g. all it becomes is: (cache-interact c f k xs) where c is the cache (agent), f is the function that generates the value you're looking for if it isn't already cached, k is the key to search for and xs is optional extra arguments that are apply'ed to f. I could have used an agent or atom to store the cache but I don't know how much is 'too much' to perform within an atom reset!/swap!. The operations performed within the critical section are all fast but there's a handful of them so I decided to err on the side of using an agent. Also, I apologize for some of the symbol names. I don't make it a habit to name things in that style. I would appreciate any feedback / recommendations for improvement. Thank you, Ryan -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.