mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 03:50:54 +01:00
Use PhabricatorCachedClassMapQuery in Conduit method lookups
Summary: Ref T11954. Depends on D16994. This implements the Conduit method cache described in that revision for a small global Conduit performance improvement. Test Plan: Verified Conduit has the same behavior at lower cost. See D16994 for details. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11954 Differential Revision: https://secure.phabricator.com/D16995
This commit is contained in:
parent
1f3fcce6fe
commit
55a54facd5
1 changed files with 9 additions and 4 deletions
|
@ -158,15 +158,20 @@ abstract class ConduitAPIMethod
|
|||
}
|
||||
|
||||
public static function loadAllConduitMethods() {
|
||||
return self::newClassMapQuery()->execute();
|
||||
}
|
||||
|
||||
private static function newClassMapQuery() {
|
||||
return id(new PhutilClassMapQuery())
|
||||
->setAncestorClass(__CLASS__)
|
||||
->setUniqueMethod('getAPIMethodName')
|
||||
->execute();
|
||||
->setUniqueMethod('getAPIMethodName');
|
||||
}
|
||||
|
||||
public static function getConduitMethod($method_name) {
|
||||
$method_map = self::loadAllConduitMethods();
|
||||
return idx($method_map, $method_name);
|
||||
return id(new PhabricatorCachedClassMapQuery())
|
||||
->setClassMapQuery(self::newClassMapQuery())
|
||||
->setMapKeyMethod('getAPIMethodName')
|
||||
->loadClass($method_name);
|
||||
}
|
||||
|
||||
public function shouldRequireAuthentication() {
|
||||
|
|
Loading…
Reference in a new issue