Merge "filebackend: avoid use of LoadBalancer::newMainLB() in LockManagerGroup"
[lhc/web/wiklou.git] / includes / libs / objectcache / MemcachedPhpBagOStuff.php
index ea73cba..b1d5d29 100644 (file)
@@ -33,7 +33,6 @@ class MemcachedPhpBagOStuff extends MemcachedBagOStuff {
        /**
         * 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.
         *   - persistent:          Whether to use a persistent connection
         *   - compress_threshold:  The minimum size an object must be before it is compressed
         *   - timeout:             The read timeout in microseconds
@@ -43,15 +42,20 @@ class MemcachedPhpBagOStuff extends MemcachedBagOStuff {
         */
        function __construct( $params ) {
                parent::__construct( $params );
-               $params = $this->applyDefaultParams( $params );
+
+               // Default class-specific parameters
+               $params += [
+                       'compress_threshold' => 1500,
+                       'connect_timeout' => 0.5
+               ];
 
                $this->client = new MemcachedClient( $params );
                $this->client->set_servers( $params['servers'] );
-               $this->client->set_debug( $params['debug'] );
        }
 
-       public function setDebug( $debug ) {
-               $this->client->set_debug( $debug );
+       public function setDebug( $enabled ) {
+               parent::debug( $enabled );
+               $this->client->set_debug( $enabled );
        }
 
        protected function doGet( $key, $flags = 0, &$casToken = null ) {
@@ -101,14 +105,14 @@ class MemcachedPhpBagOStuff extends MemcachedBagOStuff {
                return ( $n !== false && $n !== null ) ? $n : false;
        }
 
-       public function changeTTL( $key, $exptime = 0, $flags = 0 ) {
+       protected function doChangeTTL( $key, $exptime, $flags ) {
                return $this->client->touch(
                        $this->validateKeyEncoding( $key ),
                        $this->fixExpiry( $exptime )
                );
        }
 
-       public function doGetMulti( array $keys, $flags = 0 ) {
+       protected function doGetMulti( array $keys, $flags = 0 ) {
                foreach ( $keys as $key ) {
                        $this->validateKeyEncoding( $key );
                }