support setting Memcached::OPT_SERVER_FAILURE_LIMIT, Memcached::OPT_RETRY_TIMEOUT
authorasher <afeldman@wikimedia.org>
Wed, 12 Jun 2013 19:39:39 +0000 (12:39 -0700)
committerasher <afeldman@wikimedia.org>
Wed, 12 Jun 2013 19:49:38 +0000 (12:49 -0700)
Change-Id: Ib1fcae92b65e8fd23baee7af7ed64abd908b600e

includes/objectcache/MemcachedPeclBagOStuff.php

index 748c423..f962162 100644 (file)
@@ -37,6 +37,8 @@ class MemcachedPeclBagOStuff extends MemcachedBagOStuff {
         *   - compress_threshold:  The minimum size an object must be before it is compressed
         *   - timeout:             The read timeout in microseconds
         *   - connect_timeout:     The connect timeout in seconds
+        *   - retry_timeout:       Time in seconds to wait before retrying a failed connect attempt
+        *   - server_failure_limit:  Limit for server connect failures before it is removed
         *   - serializer:          May be either "php" or "igbinary". Igbinary produces more compact
         *                          values, but serialization is much slower unless the php.ini option
         *                          igbinary.compact_strings is off.
@@ -61,6 +63,14 @@ class MemcachedPeclBagOStuff extends MemcachedBagOStuff {
                        $params['serializer'] = 'php';
                }
 
+               if ( isset( $params['retry_timeout'] ) ) {
+                       $this->client->setOption( Memcached::OPT_RETRY_TIMEOUT, $params['retry_timeout'] );
+               }
+
+               if ( isset ( $params['server_failure_limit'] ) ) {
+                       $this->client->setOption( Memcached::OPT_SERVER_FAILURE_LIMIT, $params['server_failure_limit'] );
+               }
+
                // The compression threshold is an undocumented php.ini option for some
                // reason. There's probably not much harm in setting it globally, for
                // compatibility with the settings for the PHP client.