Actions
Feature proposal #2257
closedOptimize number of queries made by Kunena for loading users
Description
This goes through implementing CBuser::advanceNoticeOfUsersNeeded( array $usersId )
and a new double-cache of userids and loading of multiple CBUser and moscomprofilerUser records.
Updated by beat almost 14 years ago
- Status changed from New to Closed
- % Done changed from 0 to 100
r1371 implements this efficiently and in a backwards compatible way.
Usage:
if ( is_callable( array( 'CBuser', 'advanceNoticeOfUsersNeeded' ) ) {
CBuser::advanceNoticeOfUsersNeeded( array( 63, 64, 65 ) );
CBuser::advanceNoticeOfUsersNeeded( array( 66, 67, 65 ) );
}
echo CBuser::getUserDataInstance( 64 )->id; // echo's 64
if ( is_callable( array( 'CBuser', 'advanceNoticeOfUsersNeeded' ) ) {
CBuser::advanceNoticeOfUsersNeeded( array( 68, 67, 69, 71 ) );
}
echo CBuser::getUserDataInstance( 67 )->id; // echos 67
echo CBuser::getUserDataInstance( 69 )->username; // echos username of user id 69
API:
/**
* Sets an additional list of user records to also load and cache with next SQL query
* e.g.:
* CBuser::advanceNoticeOfUsersNeeded( array( 66, 67, 65 ) ); // just remembers
* CBuser::advanceNoticeOfUsersNeeded( array( 64, 65 ) ); // just remembers
* echo CBuser::getUserDataInstance( 64 )->id; // echo's 64 // and loads 64-67
* CBuser::advanceNoticeOfUsersNeeded( array( 68, 67, 69, 71 ) ); // just remembers
* echo CBuser::getUserDataInstance( 67 )->id; // echos 67 // and doesn't load
* echo CBuser::getUserDataInstance( 69 )->username; // echos // and loads 68,69,71
*
* @param array of int $usersIds
*/
public static function advanceNoticeOfUsersNeeded( $usersIds );
Updated by beat almost 14 years ago
- Status changed from Closed to Assigned
- % Done changed from 100 to 90
Final Tests needed with latest dev build of k1.6.3
Updated by beat almost 14 years ago
r1393 improved query in case userscount is one to use = instead of IN () for better query performance on older MySql versions
Actions