From e50fb349c34598dea68f2a4e4f182675b0268311 Mon Sep 17 00:00:00 2001 From: gered Date: Sat, 29 Mar 2014 09:27:14 -0400 Subject: [PATCH] return new value that was added to the cache i thought swap! was supposed to return this value by itself? --- src/blarg/models/posts.clj | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/blarg/models/posts.clj b/src/blarg/models/posts.clj index 27ba78c..8bfb0dc 100644 --- a/src/blarg/models/posts.clj +++ b/src/blarg/models/posts.clj @@ -15,8 +15,10 @@ (let [cached-post (get @post-md-cache _id)] (if (or (not cached-post) (after? created_at (:created_at cached-post))) - (swap! post-md-cache assoc _id {:created_at created_at - :html_body (md->html body)}) + (do + (swap! post-md-cache assoc _id {:created_at created_at + :html_body (md->html body)}) + (get @post-md-cache _id)) cached-post))) (defn- merge-cached-post-md! [post]