Page MenuHomePhabricator

Performance: Prevent double query for the same User::idFromName() call.
Closed, ResolvedPublic

Description

If the same call to User::idFromName('Test') is called twice at the 1,000 entry limit on User::$idCacheByName it will result in two database queries being ran instead of one. This is because it adds the just looked up database query to the cache then does the check to truncate the cache.

Event Timeline

Change 517108 had a related patch set uploaded (by Alexia; owner: Alexia):
[mediawiki/core@master] Truncate the idFromName cache before added the new look up to prevent a double query for the same User::idFromName() call.

https://gerrit.wikimedia.org/r/517108

Change 517108 merged by jenkins-bot:
[mediawiki/core@master] user: Move idFromName cache truncation to before adding the new value

https://gerrit.wikimedia.org/r/517108

Krinkle claimed this task.
Krinkle removed a project: Patch-For-Review.