Add `makeKey` and `makeGlobalKey` to BagOStuff
authorOri Livneh <ori@wikimedia.org>
Fri, 9 Oct 2015 23:35:08 +0000 (16:35 -0700)
committerOri Livneh <ori@wikimedia.org>
Tue, 13 Oct 2015 13:32:48 +0000 (09:32 -0400)
commit6916548490c08aaf18d1d7b33a0687cebb1d0933
tree7f67bd6db3f18081399138f73b30dccff0f42916
parent3004d6f03846fb29e9e90d0b05bd900d507c7c7b
Add `makeKey` and `makeGlobalKey` to BagOStuff

* Add a string `keyspace` member to BagOStuff instances. The default
  implementation, meant for simple key/value stores, treats the key space
  as a string prefix to prepend to keys. By default, its value is `local`,
  but any instance created via ObjectCache::newFromParams() (or or one of
  its callers) will have that default to $wgCachePrefix / wfWikiID().
* Add `makeKey` and `makeGlobalKey` methods to the base BagOStuff class.
  These methods are not static to allow for BagOStuff types which require
  a configured instance to know the underlying storage engine's key semantics.
* Make wfMemcKey() and wfGlobalCacheKey() delegate to these methods on the main
  ObjectCache instance.

Change-Id: Ib7fc2f939be3decfa97f66af8c2431c51039905f
includes/GlobalFunctions.php
includes/libs/objectcache/BagOStuff.php
includes/objectcache/ObjectCache.php
tests/phpunit/includes/GlobalFunctions/GlobalTest.php
tests/phpunit/includes/objectcache/BagOStuffTest.php