I've been working on a simple Clojure library for bounded caching and memoization. It's not quite ready for prime-time, but the simple case that you need is usable.
I'll throw it up on github when I get home tonight and post the URL here. On Dec 30, 1:35 pm, Miki <miki.teb...@gmail.com> wrote: > Hello, > > I'm wring a service that polls RSS feeds (using feedme). And I'd like to act > only on the new entries in each feed. > So far I have something like: > > (defn get-new-entries [seen] > (let [seen? (complement seen)] > (filter #(seen? (:id %)) (get-entries)))) > > (defn poll [sleep-time] > (loop [seen #{}] > (let [entries (get-new-entries seen)] > (doall (map process-entry entries)) > (println "================================") > (Thread/sleep sleep-time) > (recur (union seen (set (map :id entries))))))) > > (Full demo code athttps://gist.github.com/760094) > > The problem is that "seen" will grow without bounds. > Is there a built in way to have some sort of LRU cache or should I use > external libraries (like plru)? > > Thanks, > -- > Miki -- 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