forked from GNUsocial/gnu-social
do a short-term cache of notice scope
This commit is contained in:
parent
45ba33e2ac
commit
3e4016b388
@ -2182,6 +2182,21 @@ class Notice extends Memcached_DataObject
|
||||
* @return boolean whether the profile is in the notice's scope
|
||||
*/
|
||||
function inScope($profile)
|
||||
{
|
||||
$keypart = sprintf('notice:in-scope-for:%d:%d', $this->id, $profile->id);
|
||||
|
||||
$result = self::cacheGet($keypart);
|
||||
|
||||
if ($result === false) {
|
||||
$bResult = $this->_inScope($profile);
|
||||
$result = ($bResult) ? 1 : 0;
|
||||
self::cacheSet($keypart, $result, 0, 300);
|
||||
}
|
||||
|
||||
return ($result == 1) ? true : false;
|
||||
}
|
||||
|
||||
protected function _inScope($profile)
|
||||
{
|
||||
// If there's no scope, anyone (even anon) is in scope.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user