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 at https://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

Reply via email to