1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 12:00:55 +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:
epriestley 2016-12-06 03:53:15 -08:00
parent 1f3fcce6fe
commit 55a54facd5

View file

@ -158,15 +158,20 @@ abstract class ConduitAPIMethod
} }
public static function loadAllConduitMethods() { public static function loadAllConduitMethods() {
return self::newClassMapQuery()->execute();
}
private static function newClassMapQuery() {
return id(new PhutilClassMapQuery()) return id(new PhutilClassMapQuery())
->setAncestorClass(__CLASS__) ->setAncestorClass(__CLASS__)
->setUniqueMethod('getAPIMethodName') ->setUniqueMethod('getAPIMethodName');
->execute();
} }
public static function getConduitMethod($method_name) { public static function getConduitMethod($method_name) {
$method_map = self::loadAllConduitMethods(); return id(new PhabricatorCachedClassMapQuery())
return idx($method_map, $method_name); ->setClassMapQuery(self::newClassMapQuery())
->setMapKeyMethod('getAPIMethodName')
->loadClass($method_name);
} }
public function shouldRequireAuthentication() { public function shouldRequireAuthentication() {