Version 4.6.0
This commit is contained in:
1 parent
f79dcf067a
commit
517a5e1f70
2036 files changed
+110041
-26162
No files matched your search
@@ -549,6 +549,11 @@ abstract class _ActiveRecord
|
||||
|
||||
$this->clearCaches( TRUE );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Cache followers count query to prevent running it multiple times
|
||||
*/
|
||||
protected static $followerCountCache = array();
|
||||
|
||||
/**
|
||||
* Get follow data
|
||||
@@ -592,9 +597,18 @@ abstract class _ActiveRecord
|
||||
}
|
||||
else
|
||||
{
|
||||
$_key = md5( static::$application . $area . $id );
|
||||
|
||||
if( isset( static::$followerCountCache[ $_key ] ) )
|
||||
{
|
||||
return static::$followerCountCache[ $_key ];
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return (int) \IPS\Db::i()->select( 'count', 'core_follow_count_cache', array('class=? and id=?', 'IPS\\' . static::$application . '\\' . ucfirst( $area ), $id) )->first();
|
||||
static::$followerCountCache[ $_key ] = (int) \IPS\Db::i()->select( 'count', 'core_follow_count_cache', array('class=? and id=?', 'IPS\\' . static::$application . '\\' . ucfirst( $area ), $id ) )->first();
|
||||
|
||||
return static::$followerCountCache[ $_key ];
|
||||
}
|
||||
catch ( \UnderflowException $e )
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user