From: Evan Prodromou Date: Thu, 3 Feb 2011 18:58:56 +0000 (-0500) Subject: only blow public timeline cache if notice is in it X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5f365e75ca15c9777ab1930b416abae4d9d4d7cc;p=quix0rs-gnu-social.git only blow public timeline cache if notice is in it --- diff --git a/classes/Notice.php b/classes/Notice.php index e9ea479e14..2d13828f1f 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -446,7 +446,10 @@ class Notice extends Memcached_DataObject function blowOnInsert($conversation = false) { self::blow('profile:notice_ids:%d', $this->profile_id); - self::blow('public'); + + if ($this->isPublic()) { + self::blow('public'); + } // XXX: Before we were blowing the casche only if the notice id // was not the root of the conversation. What to do now? @@ -481,7 +484,10 @@ class Notice extends Memcached_DataObject $this->blowOnInsert(); self::blow('profile:notice_ids:%d;last', $this->profile_id); - self::blow('public;last'); + + if ($this->isPublic()) { + self::blow('public;last'); + } } /** save all urls in the notice to the db @@ -2107,4 +2113,14 @@ class Notice extends Memcached_DataObject $obj->whereAdd($max); } } + + function isPublic() + { + if (common_config('public', 'localonly')) { + return ($this->is_local == Notice::LOCAL_PUBLIC); + } else { + return (($this->is_local != Notice::LOCAL_NONPUBLIC) && + ($this->is_local != Notice::GATEWAY)); + } + } }