User: Simplify process cache by using WANObjectCache::getWithSetCallback
Follows-up
7d67b4d919,
9c733318.
* Convert loadFromId() to use getWithSetCallback() and centralise
cache access logic there instead of spread between loadFromCache()
and saveToCache().
* Remove process cache from User class (added in
9c733318).
Instead, tell WANObjectCache to process-cache the key for 30 seconds.
* No need to deal with process cache in purge() because load uses slaves by
default and may be lagged. Reads that require READ_LATEST already bypass
the cache.
* Remove saveToCache() and move logic to loadFromCache().
It was technically a public method, but marked private and no longer used
in any extensions.
* Remove redundant isAnon() check in loadFromCache().
This is already done by loadFromId() and loadFromDatabase().
* Remove hasOrMadeRecentMasterChanges() check. It was used to add READ_LATEST
to the flags. However, this check only occurred if either READ_LATEST was
already set, or after consulting cache. Which means in general, it never
does anything. If we want to keep this, we should probably move it higher up.
* Let WANObjectCache handle cache version. That way, there is no longer separate
logic for "populate cache" and "cache lookup failed". Instead, there is
just "get data" that tries cache first.
I've considered moving the version into the cache key (like we do elsewhere)
but that would be problematic here since User cache must be purgeable
cross-wiki and other wikis may run a different version (either in general,
or even just during a deployment). As such, the key must remain unchanged when
the version changes so that purges from newer wikis affect what older wikis see
and vice versa.
Change-Id: Icfbc54dfd0ea594dd52fc1cfd403a7f66f1dd0b0