      ((alter users-cache assoc user (ref {})) user))))
 
 (defn newcount-get-new [user id]
-  (dosync
-   (let [user-cache (get-newcount user)]
-     (if (and (not= nil user-cache) (contains? @user-cache id))
-       (:c (@user-cache id))
-       0))))
+  (let [user-cache (get-newcount user)]
+    (.info logger (str "User " user " cache " (:c (@user-cache id) )))
+    (if (and (not= nil user-cache) (contains? @user-cache id))
+      (:c (@user-cache id))
+      0)))
   
 (defn newcount-reset [user id]
   (dosync


(defn newcount-comment-ex [id]
  (let [users (mc/distinct ONUSER "username" {})]
    (future (.debug logger (str "Comment cache increment. Distributed to: " (count (map (partial newcount-cache-inc id) users)))))))

(defn newcount-uncomment-ex [id]
  (let [users (mc/distinct ONUSER "username" {})]
    (future (.debug logger (str "Comment cache decrement. Distributed to: " (count (map (partial newcount-cache-dec id) users)))))))
       (alter user-newcount-ref assoc id {:ts now :c 1})))))

(defn newcount-cache-inc [id user] (newcount-cache-mod + id user))

(defn zero-cache [id] 0)

