Cache user data in memory
Stores user data looked up in WAN cache in memory so that lookups in the
same request do not result in new memcached lookups.
Quick and dirty solution, but nicer ones are more difficult:
* no idea what replacing WANObjectCache::get/set with getWithSetCallback
(which has its own in-process cache) would do, the code is complex
and completely different
* would be nice to wrap the logic into a proxy object (like CachedBagOStuff)
but WANObjectCache calls set() internally (and marks it final), so
inheriting is not safe; the interface and implementation should be
separated, and that means updating all external callers which do a type
check.
* ObjectCache::getInstance('hash') cannot be used because it has no
item limit and this could eat up the memory with a script that iterates
through lots of users
The patch does not attempt to replicate tombstoning for
User::clearSharedCache('refresh').
Based on Iec1504700a and Idef9a9d3.
Change-Id: I419f356b0c306d16711b433da95dccdb44645154
Co-Authored-By: Ori Livneh <ori@wikimedia.org>
Bug: T128157