summaryrefslogtreecommitdiff
path: root/includes/objectcache/ObjectCache.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2014-12-27 15:41:37 +0100
committerPierre Schmitz <pierre@archlinux.de>2014-12-31 11:43:28 +0100
commitc1f9b1f7b1b77776192048005dcc66dcf3df2bfb (patch)
tree2b38796e738dd74cb42ecd9bfd151803108386bc /includes/objectcache/ObjectCache.php
parentb88ab0086858470dd1f644e64cb4e4f62bb2be9b (diff)
Update to MediaWiki 1.24.1
Diffstat (limited to 'includes/objectcache/ObjectCache.php')
-rw-r--r--includes/objectcache/ObjectCache.php28
1 files changed, 18 insertions, 10 deletions
diff --git a/includes/objectcache/ObjectCache.php b/includes/objectcache/ObjectCache.php
index 6c1433a9..633b34a2 100644
--- a/includes/objectcache/ObjectCache.php
+++ b/includes/objectcache/ObjectCache.php
@@ -27,12 +27,12 @@
* @ingroup Cache
*/
class ObjectCache {
- static $instances = array();
+ public static $instances = array();
/**
* Get a cached instance of the specified type of cache object.
*
- * @param $id string
+ * @param string $id
*
* @return BagOStuff
*/
@@ -56,7 +56,7 @@ class ObjectCache {
/**
* Create a new cache object of the specified type.
*
- * @param $id string
+ * @param string $id
*
* @throws MWException
* @return BagOStuff
@@ -75,7 +75,7 @@ class ObjectCache {
/**
* Create a new cache object from parameters
*
- * @param $params array
+ * @param array $params
*
* @throws MWException
* @return BagOStuff
@@ -87,8 +87,9 @@ class ObjectCache {
$class = $params['class'];
return new $class( $params );
} else {
- throw new MWException( "The definition of cache type \"" . print_r( $params, true ) . "\" lacks both " .
- "factory and class parameters." );
+ throw new MWException( "The definition of cache type \""
+ . print_r( $params, true ) . "\" lacks both "
+ . "factory and class parameters." );
}
}
@@ -101,7 +102,7 @@ class ObjectCache {
* be an alias to the configured cache choice for that.
* If no cache choice is configured (by default $wgMainCacheType is CACHE_NONE),
* then CACHE_ANYTHING will forward to CACHE_DB.
- * @param $params array
+ * @param array $params
* @return BagOStuff
*/
static function newAnything( $params ) {
@@ -118,11 +119,15 @@ class ObjectCache {
/**
* Factory function referenced from DefaultSettings.php for CACHE_ACCEL.
*
- * @param $params array
+ * This will look for any APC style server-local cache.
+ * A fallback cache can be specified if none is found.
+ *
+ * @param array $params
+ * @param int|string $fallback Fallback cache, e.g. (CACHE_NONE, "hash") (since 1.24)
* @throws MWException
* @return BagOStuff
*/
- static function newAccelerator( $params ) {
+ static function newAccelerator( $params, $fallback = null ) {
if ( function_exists( 'apc_fetch' ) ) {
$id = 'apc';
} elseif ( function_exists( 'xcache_get' ) && wfIniGetBool( 'xcache.var_size' ) ) {
@@ -130,6 +135,9 @@ class ObjectCache {
} elseif ( function_exists( 'wincache_ucache_get' ) ) {
$id = 'wincache';
} else {
+ if ( $fallback ) {
+ return self::newFromId( $fallback );
+ }
throw new MWException( "CACHE_ACCEL requested but no suitable object " .
"cache is present. You may want to install APC." );
}
@@ -143,7 +151,7 @@ class ObjectCache {
* hashing scheme and a different interpretation of the flags bitfield, so
* switching between the two clients randomly would be disastrous.
*
- * @param $params array
+ * @param array $params
*
* @return MemcachedPhpBagOStuff
*/