summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-01-13 00:16:54 -0800
committerEvan Prodromou <evan@status.net>2010-01-13 00:16:54 -0800
commit3d579fc58007ccb20657bc3959aad220e72e8f30 (patch)
tree739783c12ca497b0f77465a7f1f934273550e24c
parentf05ae1f210021d8aab022ff80f102bcb6834078f (diff)
memoize Notice::whoGets()
-rw-r--r--classes/Notice.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/classes/Notice.php b/classes/Notice.php
index 306956422..c8edc98e1 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;
}