objectcache: replace debugLog() calls with faster debug() calls in MemcachedPeclBagOStuff
authorAaron Schulz <aschulz@wikimedia.org>
Sat, 27 Apr 2019 04:10:05 +0000 (21:10 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Sat, 27 Apr 2019 04:10:05 +0000 (21:10 -0700)
Change-Id: Iefe29d43f2bc8efa8288b4625d20bd803f35bbfe

includes/libs/objectcache/MemcachedBagOStuff.php
includes/libs/objectcache/MemcachedPeclBagOStuff.php

index 71e3331..3d6bd16 100644 (file)
@@ -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 );
-       }
 }
index 692771d..db94503 100644 (file)
@@ -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 );
        }