]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
memoize Notice::whoGets()
authorEvan Prodromou <evan@status.net>
Wed, 13 Jan 2010 08:16:54 +0000 (00:16 -0800)
committerEvan Prodromou <evan@status.net>
Wed, 13 Jan 2010 08:16:54 +0000 (00:16 -0800)
classes/Notice.php

index 3069564227859a2d39171bdec1af8b0197cb02b6..c8edc98e1a2205000c59407dc763091a6b2164a9 100644 (file)
@@ -828,6 +828,15 @@ class Notice extends Memcached_DataObject
 
     function whoGets()
     {
+        $c = self::memcache();
+
+        if (!empty($c)) {
+            $ni = $c->get(common_cache_key('notice:who_gets:'.$this->id));
+            if ($ni !== false) {
+                return $ni;
+            }
+        }
+
         $users = $this->getSubscribedUsers();
 
         // FIXME: kind of ignoring 'transitional'...
@@ -867,6 +876,11 @@ class Notice extends Memcached_DataObject
             }
         }
 
+        if (!empty($c)) {
+            // XXX: pack this data better
+            $c->set(common_cache_key('notice:who_gets:'.$this->id), $ni);
+        }
+
         return $ni;
     }