From: Aaron Schulz Date: Sat, 24 Oct 2015 22:16:59 +0000 (-0700) Subject: Fix bogus calls to encodeKey/decodeKey in the PHP memcached class X-Git-Tag: 1.31.0-rc.0~9260^2 X-Git-Url: https://git.heureux-cyclage.org/?a=commitdiff_plain;h=51fe42fc1a677492c9cf80e3d2002c991b33f5af;p=lhc%2Fweb%2Fwiklou.git Fix bogus calls to encodeKey/decodeKey in the PHP memcached class * Follow up to cdb543272883b180 * These are no longer needed Change-Id: Id41c3aae50a13f3c53f2bbd9662027b36a1f4142 --- diff --git a/includes/libs/objectcache/MemcachedPhpBagOStuff.php b/includes/libs/objectcache/MemcachedPhpBagOStuff.php index bbb09fe717..1bb38fa10b 100644 --- a/includes/libs/objectcache/MemcachedPhpBagOStuff.php +++ b/includes/libs/objectcache/MemcachedPhpBagOStuff.php @@ -27,10 +27,7 @@ * @ingroup Cache */ class MemcachedPhpBagOStuff extends MemcachedBagOStuff { - /** - * Constructor. - * * Available parameters are: * - servers: The list of IP:port combinations holding the memcached servers. * - debug: Whether to set the debug flag in the underlying client. @@ -50,39 +47,27 @@ class MemcachedPhpBagOStuff extends MemcachedBagOStuff { $this->client->set_debug( $params['debug'] ); } - /** - * @param bool $debug - */ public function setDebug( $debug ) { $this->client->set_debug( $debug ); } public function getMulti( array $keys, $flags = 0 ) { - $callback = array( $this, 'encodeKey' ); - $encodedResult = $this->client->get_multi( array_map( $callback, $keys ) ); - $result = array(); - foreach ( $encodedResult as $key => $value ) { - $key = $this->decodeKey( $key ); - $result[$key] = $value; + foreach ( $keys as $key ) { + $this->validateKeyEncoding( $key ); } - return $result; + + return $this->client->get_multi( $keys ); } - /** - * @param string $key - * @param int $value - * @return mixed - */ public function incr( $key, $value = 1 ) { - return $this->client->incr( $this->encodeKey( $key ), $value ); + $this->validateKeyEncoding( $key ); + + return $this->client->incr( $key, $value ); } - /** - * @param string $key - * @param int $value - * @return mixed - */ public function decr( $key, $value = 1 ) { - return $this->client->decr( $this->encodeKey( $key ), $value ); + $this->validateKeyEncoding( $key ); + + return $this->client->decr( $key, $value ); } }