From: Aaron Schulz Date: Sat, 27 Apr 2019 04:10:05 +0000 (-0700) Subject: objectcache: replace debugLog() calls with faster debug() calls in MemcachedPeclBagOStuff X-Git-Tag: 1.34.0-rc.0~1848^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=cf4562191396dde6512b0c5c123d11fc79b180fa objectcache: replace debugLog() calls with faster debug() calls in MemcachedPeclBagOStuff Change-Id: Iefe29d43f2bc8efa8288b4625d20bd803f35bbfe --- diff --git a/includes/libs/objectcache/MemcachedBagOStuff.php b/includes/libs/objectcache/MemcachedBagOStuff.php index 71e3331708..3d6bd16129 100644 --- a/includes/libs/objectcache/MemcachedBagOStuff.php +++ b/includes/libs/objectcache/MemcachedBagOStuff.php @@ -175,12 +175,4 @@ class MemcachedBagOStuff extends BagOStuff { } return (int)$expiry; } - - /** - * Send a debug message to the log - * @param string $text - */ - protected function debugLog( $text ) { - $this->logger->debug( $text ); - } } diff --git a/includes/libs/objectcache/MemcachedPeclBagOStuff.php b/includes/libs/objectcache/MemcachedPeclBagOStuff.php index 692771dcfb..db9450387f 100644 --- a/includes/libs/objectcache/MemcachedPeclBagOStuff.php +++ b/includes/libs/objectcache/MemcachedPeclBagOStuff.php @@ -142,7 +142,7 @@ class MemcachedPeclBagOStuff extends MemcachedBagOStuff { * @suppress PhanTypeNonVarPassByRef */ protected function doGet( $key, $flags = 0, &$casToken = null ) { - $this->debugLog( "get($key)" ); + $this->debug( "get($key)" ); if ( defined( Memcached::class . '::GET_EXTENDED' ) ) { // v3.0.0 $flags = Memcached::GET_EXTENDED; $res = $this->client->get( $this->validateKeyEncoding( $key ), null, $flags ); @@ -161,7 +161,7 @@ class MemcachedPeclBagOStuff extends MemcachedBagOStuff { } public function set( $key, $value, $exptime = 0, $flags = 0 ) { - $this->debugLog( "set($key)" ); + $this->debug( "set($key)" ); $result = parent::set( $key, $value, $exptime, $flags = 0 ); if ( $result === false && $this->client->getResultCode() === Memcached::RES_NOTSTORED ) { // "Not stored" is always used as the mcrouter response with AllAsyncRoute @@ -171,12 +171,12 @@ class MemcachedPeclBagOStuff extends MemcachedBagOStuff { } protected function cas( $casToken, $key, $value, $exptime = 0, $flags = 0 ) { - $this->debugLog( "cas($key)" ); + $this->debug( "cas($key)" ); return $this->checkResult( $key, parent::cas( $casToken, $key, $value, $exptime, $flags ) ); } public function delete( $key, $flags = 0 ) { - $this->debugLog( "delete($key)" ); + $this->debug( "delete($key)" ); $result = parent::delete( $key ); if ( $result === false && $this->client->getResultCode() === Memcached::RES_NOTFOUND ) { // "Not found" is counted as success in our interface @@ -186,18 +186,18 @@ class MemcachedPeclBagOStuff extends MemcachedBagOStuff { } public function add( $key, $value, $exptime = 0, $flags = 0 ) { - $this->debugLog( "add($key)" ); + $this->debug( "add($key)" ); return $this->checkResult( $key, parent::add( $key, $value, $exptime ) ); } public function incr( $key, $value = 1 ) { - $this->debugLog( "incr($key)" ); + $this->debug( "incr($key)" ); $result = $this->client->increment( $key, $value ); return $this->checkResult( $key, $result ); } public function decr( $key, $value = 1 ) { - $this->debugLog( "decr($key)" ); + $this->debug( "decr($key)" ); $result = $this->client->decrement( $key, $value ); return $this->checkResult( $key, $result ); } @@ -223,7 +223,7 @@ class MemcachedPeclBagOStuff extends MemcachedBagOStuff { case Memcached::RES_DATA_EXISTS: case Memcached::RES_NOTSTORED: case Memcached::RES_NOTFOUND: - $this->debugLog( "result: " . $this->client->getResultMessage() ); + $this->debug( "result: " . $this->client->getResultMessage() ); break; default: $msg = $this->client->getResultMessage(); @@ -243,7 +243,7 @@ class MemcachedPeclBagOStuff extends MemcachedBagOStuff { } public function getMulti( array $keys, $flags = 0 ) { - $this->debugLog( 'getMulti(' . implode( ', ', $keys ) . ')' ); + $this->debug( 'getMulti(' . implode( ', ', $keys ) . ')' ); foreach ( $keys as $key ) { $this->validateKeyEncoding( $key ); } @@ -252,7 +252,7 @@ class MemcachedPeclBagOStuff extends MemcachedBagOStuff { } public function setMulti( array $data, $exptime = 0, $flags = 0 ) { - $this->debugLog( 'setMulti(' . implode( ', ', array_keys( $data ) ) . ')' ); + $this->debug( 'setMulti(' . implode( ', ', array_keys( $data ) ) . ')' ); foreach ( array_keys( $data ) as $key ) { $this->validateKeyEncoding( $key ); } @@ -261,7 +261,7 @@ class MemcachedPeclBagOStuff extends MemcachedBagOStuff { } public function changeTTL( $key, $expiry = 0, $flags = 0 ) { - $this->debugLog( "touch($key)" ); + $this->debug( "touch($key)" ); $result = $this->client->touch( $key, $expiry ); return $this->checkResult( $key, $result ); }