'MWExceptionHandler' => __DIR__ . '/includes/exception/MWExceptionHandler.php',
'MWHookException' => __DIR__ . '/includes/Hooks.php',
'MWHttpRequest' => __DIR__ . '/includes/HttpFunctions.php',
- 'MWMemcached' => __DIR__ . '/includes/libs/objectcache/MemcachedClient.php',
+ 'MWMemcached' => __DIR__ . '/includes/compat/MemcachedClientCompat.php',
'MWMessagePack' => __DIR__ . '/includes/libs/MWMessagePack.php',
'MWNamespace' => __DIR__ . '/includes/MWNamespace.php',
'MWOldPassword' => __DIR__ . '/includes/password/MWOldPassword.php',
'MediaWiki\\Widget\\NamespaceInputWidget' => __DIR__ . '/includes/widget/NamespaceInputWidget.php',
'MediaWiki\\Widget\\TitleInputWidget' => __DIR__ . '/includes/widget/TitleInputWidget.php',
'MediaWiki\\Widget\\UserInputWidget' => __DIR__ . '/includes/widget/UserInputWidget.php',
- 'MemCachedClientforWiki' => __DIR__ . '/includes/libs/objectcache/MemcachedClient.php',
+ 'MemCachedClientforWiki' => __DIR__ . '/includes/compat/MemcachedClientCompat.php',
'MemcLockManager' => __DIR__ . '/includes/filebackend/lockmanager/MemcLockManager.php',
'MemcachedBagOStuff' => __DIR__ . '/includes/libs/objectcache/MemcachedBagOStuff.php',
+ 'MemcachedClient' => __DIR__ . '/includes/libs/objectcache/MemcachedClient.php',
'MemcachedPeclBagOStuff' => __DIR__ . '/includes/objectcache/MemcachedPeclBagOStuff.php',
'MemcachedPhpBagOStuff' => __DIR__ . '/includes/libs/objectcache/MemcachedPhpBagOStuff.php',
'MemoizedCallable' => __DIR__ . '/includes/libs/MemoizedCallable.php',
--- /dev/null
+<?php
+/**
+ * Backward-compatibility alias for MemcachedClient
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @since 1.27
+ * @file
+ */
+
+/**
+ * @deprecated since 1.27
+ */
+class MWMemcached extends MemcachedClient {
+}
+
+/**
+ * @deprecated since 1.27
+ */
+class MemCachedClientforWiki extends MWMemcached {
+}
* @ingroup Cache
*/
class MemcachedBagOStuff extends BagOStuff {
- /** @var MWMemcached|Memcached */
+ /** @var MemcachedClient|Memcached */
protected $client;
/**
/**
* Get the underlying client object. This is provided for debugging
* purposes.
- * @return BagOStuff
+ * @return MemcachedClient|Memcached
*/
public function getClient() {
return $this->client;
*/
/**
- * This is the PHP client for memcached - a distributed memory cache daemon.
+ * This is a PHP client for memcached - a distributed memory cache daemon.
+ *
* More information is available at http://www.danga.com/memcached/
*
* Usage example:
*
- * require_once 'memcached.php';
- *
- * $mc = new MWMemcached(array(
- * 'servers' => array('127.0.0.1:10000',
- * array('192.0.0.1:10010', 2),
- * '127.0.0.1:10020'),
- * 'debug' => false,
- * 'compress_threshold' => 10240,
- * 'persistent' => true));
+ * $mc = new MemcachedClient(array(
+ * 'servers' => array(
+ * '127.0.0.1:10000',
+ * array( '192.0.0.1:10010', 2 ),
+ * '127.0.0.1:10020'
+ * ),
+ * 'debug' => false,
+ * 'compress_threshold' => 10240,
+ * 'persistent' => true
+ * ));
*
- * $mc->add( 'key', array( 'some', 'array' ) );
- * $mc->replace( 'key', 'some random string' );
- * $val = $mc->get( 'key' );
+ * $mc->add( 'key', array( 'some', 'array' ) );
+ * $mc->replace( 'key', 'some random string' );
+ * $val = $mc->get( 'key' );
*
- * @author Ryan T. Dean <rtdean@cytherianage.net>
+ * @author Ryan T. Dean <rtdean@cytherianage.net>
* @version 0.1.2
*/
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
-// {{{ requirements
-// }}}
-
-// {{{ class MWMemcached
+// {{{ class MemcachedClient
/**
* memcached client class implemented using (p)fsockopen()
*
* @author Ryan T. Dean <rtdean@cytherianage.net>
* @ingroup Cache
*/
-class MWMemcached {
+class MemcachedClient {
// {{{ properties
// {{{ public
// {{{ set_compress_threshold()
/**
- * Sets the compression threshold
+ * Set the compression threshold
*
* @param int $thresh Threshold to compress if larger than
*/
// {{{ set_debug()
/**
- * Sets the debug flag
+ * Set the debug flag
*
+ * @see __construct()
* @param bool $dbg True for debugging, false otherwise
- *
- * @see MWMemcached::__construct
*/
public function set_debug( $dbg ) {
$this->_debug = $dbg;
// {{{ set_servers()
/**
- * Sets the server list to distribute key gets and puts between
+ * Set the server list to distribute key gets and puts between
*
+ * @see __construct()
* @param array $list Array of servers to connect to
- *
- * @see MWMemcached::__construct()
*/
public function set_servers( $list ) {
$this->_servers = $list;
}
// }}}
-
-class MemCachedClientforWiki extends MWMemcached {
-}
parent::__construct( $params );
$params = $this->applyDefaultParams( $params );
- $this->client = new MWMemcached( $params );
+ $this->client = new MemcachedClient( $params );
$this->client->set_servers( $params['servers'] );
$this->client->set_debug( $params['debug'] );
}
* values, but serialization is much slower unless the php.ini option
* igbinary.compact_strings is off.
* @param array $params
- * @throws MWException
+ * @throws InvalidArgumentException
*/
function __construct( $params ) {
parent::__construct( $params );
// is as good as any. There's no way to configure libmemcached to use
// hashes identical to the ones currently in use by the PHP client, and
// even implementing one of the libmemcached hashes in pure PHP for
- // forwards compatibility would require MWMemcached::get_sock() to be
+ // forwards compatibility would require MemcachedClient::get_sock() to be
// rewritten.
$this->client->setOption( Memcached::OPT_LIBKETAMA_COMPATIBLE, true );
mccShowUsage();
exit( 0 );
}
-$mcc = new MWMemcached( array(
+$mcc = new MemcachedClient( array(
'persistent' => true,
'debug' => $debug,
) );