diff --git a/src/main/om/next/cache.cljs b/src/main/om/next/cache.cljs index 94992582..9cc56906 100644 --- a/src/main/om/next/cache.cljs +++ b/src/main/om/next/cache.cljs @@ -3,10 +3,11 @@ (deftype Cache [arr index size] Object (add [this id x] - (if (<= size (alength arr)) - (let [id' (.shift arr)] - (swap! index #(-> % (dissoc id') (assoc id x)))) - (swap! index assoc id x)) + (let [x' (vary-meta x assoc :client-time (js/Date.))] + (if (<= size (alength arr)) + (let [id' (.shift arr)] + (swap! index #(-> % (dissoc id') (assoc id x')))) + (swap! index assoc id x'))) (.push arr id)) (get [this id] (get @index id)))