HomePhabricator

* Rewrote ObjectCache.php to conform to the modern coding style, and to be…

Description

  • Rewrote ObjectCache.php to conform to the modern coding style, and to be less convoluted about how CACHE_ANYTHING and CACHE_ACCEL are resolved. Moved most functionality to static members of a new ObjectCache class.
  • Moved the global functions to GlobalFunctions.php, where they are now just convenience wrappers. Made them return non-references. Updated callers (none found in extensions).
  • Added an advanced configuration method, $wgObjectCaches, which allows a lot more detail in the object cache configuration than $wgMainCacheType.
  • Made all object cache classes derive from BagOStuff.
  • Split the MWMemcached class into a generic client class and a MediaWiki-specific wrapper class. The wrapper class presents a simple BagOStuff interface to calling code, hiding memcached client internals, and will simplify the task of supporting the PECL extension.
  • Added some extra constructor parameters to MWMemcached, configurable via $wgObjectCaches.
  • Removed the *_multi() methods from BagOStuff, my grepping indicates that they are not used.
  • Rewrote FakeMemCachedClient as a BagOStuff subclass, called EmptyBagOStuff.
  • Added an optional "server" parameter to SQLBagOStuff. This allows the server holding the objectcache table to be different from the server holding the core DB.
  • Added MultiWriteBagOStuff: a cache class which writes to multiple locations, and reads from them in a defined fallback sequence. This can be used to extend the cache space by adding disk-backed storage to existing in-memory caches.
  • Made MWMemcached::get() return false on failure instead of null, to match the BagOStuff documentation and the other BagOStuff subclasses. Anything that was relying on it returning null would have already been broken with SqlBagOStuff.
  • Fixed a bug in the memcached client causing keys with spaces or line breaks in them to break the memcached protocol, injecting arbitrary commands or parameters. Since the PECL client apparently also has this flaw, I implemented the fix in the wrapper class.
  • Renamed BagOStuff::set_debug() to setDebug(), since we aren't emulating the memcached client anymore
  • Fixed spelling error in MWMemcached: persistant -> persistent

Details

Provenance
tstarlingAuthored on
Parents
rSVN83139: Small js issues
Branches
Unknown
Tags
Unknown
ChangeId
None