*/
class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Selector_API {
+ const CACHE_SIZE = 500;
+
/**
* This defines two actions- View and Edit.
*
// $sortByCharacter triggers a refresh in the prevNext cache
if ($sortByCharacter && $sortByCharacter != 'all') {
$cacheKey .= "_alphabet";
- $this->fillupPrevNextCache($sort, $cacheKey, 0, max(500, $pageSize));
+ $this->fillupPrevNextCache($sort, $cacheKey, 0, max(self::CACHE_SIZE, $pageSize));
}
elseif (($firstRecord + $pageSize) >= $countRow) {
- $this->fillupPrevNextCache($sort, $cacheKey, $countRow, max(500, $pageSize) + $firstRecord - $countRow);
+ $this->fillupPrevNextCache($sort, $cacheKey, $countRow, max(self::CACHE_SIZE, $pageSize) + $firstRecord - $countRow);
}
return $cacheKey;
}
* @param int $start
* @param int $end
*/
- public function fillupPrevNextCache($sort, $cacheKey, $start = 0, $end = 500) {
+ public function fillupPrevNextCache($sort, $cacheKey, $start = 0, $end = self::CACHE_SIZE) {
$coreSearch = TRUE;
// For custom searches, use the contactIDs method
if (is_a($this, 'CRM_Contact_Selector_Custom')) {
$dao = CRM_Core_DAO::executeQuery($sql);
- // build insert query, note that currently we build cache for 500 contact records at a time, hence below approach
+ // build insert query, note that currently we build cache for 500 (self::CACHE_SIZE) contact records at a time, hence below approach
$insertValues = array();
while ($dao->fetch()) {
$insertValues[] = "('civicrm_contact', {$dao->contact_id}, {$dao->contact_id}, '{$cacheKey}', '" . CRM_Core_DAO::escapeString($dao->sort_name) . "')";