I see, it works now.

So we need to call evict explicitly if we want to remove an entry? no 
automatic deletion after expiring?

On Tuesday, October 23, 2012 1:21:54 AM UTC+3, Sean Corfield wrote:
>
> On Mon, Oct 22, 2012 at 3:08 PM, Hussein B. <hubag...@gmail.com<javascript:>> 
> wrote: 
> > I tried this: 
> > 
> > (defn hit-or-miss 
> >   [a k v] 
> >   (if (c/has? @a k) 
> >     (c/hit @a k) 
> >     (c/miss @a k v))) 
>
> My bad... got a bit carried away with the derefs based on code I was 
> playing around with in the REPL. Try this: 
>
> (defn hit-or-miss 
>   [c k v] 
>   (if (c/has? c k) 
>     (c/hit c k) 
>     (c/miss c k v))) 
>
> (swap! acu hit-or-miss :e 55) 
>
> That will update the atom to hold the new cache with {:e 55}. 
> -- 
> Sean A Corfield -- (904) 302-SEAN 
> An Architect's View -- http://corfield.org/ 
> World Singles, LLC. -- http://worldsingles.com/ 
>
> "Perfection is the enemy of the good." 
> -- Gustave Flaubert, French realist novelist (1821-1880) 
>

-- 
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