From: Evan Prodromou Date: Wed, 13 Jan 2010 08:16:54 +0000 (-0800) Subject: memoize Notice::whoGets() X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3d579fc58007ccb20657bc3959aad220e72e8f30;p=quix0rs-gnu-social.git memoize Notice::whoGets() --- diff --git a/classes/Notice.php b/classes/Notice.php index 3069564227..c8edc98e1a 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -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; }