]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Conversation.php
Merge branch 'master' into 1.0.x
[quix0rs-gnu-social.git] / classes / Conversation.php
index aab55723f644188720268fb4076629ab4e8d417f..e029c20ba0d095145cff147b35aaec6f49d5dd5b 100755 (executable)
@@ -74,4 +74,23 @@ class Conversation extends Memcached_DataObject
 
         return $conv;
     }
+
+    static function noticeCount($id)
+    {
+        $keypart = sprintf('conversation:notice_count:%d', $id);
+
+        $cnt = self::cacheGet($keypart);
+
+        if ($cnt !== false) {
+            return $cnt;
+        }
+
+        $notice               = new Notice();
+        $notice->conversation = $id;
+        $cnt                  = $notice->count();
+
+        self::cacheSet($keypart, $cnt);
+
+        return $cnt;
+    }
 }