mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-18 12:52:42 +01:00
Don't spend ridiculous amounts of time rebuilding orderable columns
Summary: Ref T8575. Because orderable columns need to build custom fields, they are relatively expensive to build. Use the request cache. (The request cache is technically more correct than `static`, because configuration may change between requests and we may eventually reuse interpreters.) Test Plan: Saw home page time drop 39% (from 462ms to 283ms). Reviewers: btrahan, avivey Reviewed By: avivey Subscribers: avivey, epriestley Maniphest Tasks: T8575 Differential Revision: https://secure.phabricator.com/D13322
This commit is contained in:
parent
8484adcffd
commit
6933ee5fb8
1 changed files with 11 additions and 0 deletions
|
@ -872,6 +872,15 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
|
||||||
* @task order
|
* @task order
|
||||||
*/
|
*/
|
||||||
public function getOrderableColumns() {
|
public function getOrderableColumns() {
|
||||||
|
$cache = PhabricatorCaches::getRequestCache();
|
||||||
|
$class = get_class($this);
|
||||||
|
$cache_key = 'query.orderablecolumns.'.$class;
|
||||||
|
|
||||||
|
$columns = $cache->getKey($cache_key);
|
||||||
|
if ($columns !== null) {
|
||||||
|
return $columns;
|
||||||
|
}
|
||||||
|
|
||||||
$columns = array(
|
$columns = array(
|
||||||
'id' => array(
|
'id' => array(
|
||||||
'table' => $this->getPrimaryTableAlias(),
|
'table' => $this->getPrimaryTableAlias(),
|
||||||
|
@ -909,6 +918,8 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$cache->setKey($cache_key, $columns);
|
||||||
|
|
||||||
return $columns;
|
return $columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue