And if you don't have time to read the whole blog post - it's very
detailed - and just read code, you could scroll down to cgrand's
memoize8 function at https://gist.github.com/330644

On Feb 6, 8:32 pm, Eugen Dück <eu...@dueck.org> wrote:
> A while back the discussion on the "bounded memoize" thread in this
> forum lead to Meikel writing up a nice summary of how to do caching,
> providing a pluggable strategy: lru, ttl, fifo, etc. Meikel's writeup
> can be found athttp://kotka.de/blog/2010/03/memoize_done_right.html
>
> It presents a bunch of different implementations, detailing whats good/
> bad about each of them.
>
> On Dec 31 2010, 3:35 am, 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

Reply via email to