Allow binary protocol to be toggled with Memcached driver.
This commit is contained in:
parent
8d14b21ad8
commit
42743def8d
3 changed files with 13 additions and 2 deletions
|
@ -676,7 +676,9 @@ class WP_FFPC_Backend {
|
|||
|
||||
/* use binary and not compressed format, good for nginx and still fast */
|
||||
$this->connection->setOption( Memcached::OPT_COMPRESSION , false );
|
||||
$this->connection->setOption( Memcached::OPT_BINARY_PROTOCOL , true );
|
||||
if ($this->options['memcached_binary']){
|
||||
$this->connection->setOption( Memcached::OPT_BINARY_PROTOCOL , true );
|
||||
}
|
||||
|
||||
if ( version_compare( phpversion( 'memcached' ) , '2.0.0', '>=' ) && ini_get( 'memcached.use_sasl' ) == 1 && isset($this->options['authpass']) && !empty($this->options['authpass']) && isset($this->options['authuser']) && !empty($this->options['authuser']) ) {
|
||||
$this->connection->setSaslAuthData ( $this->options['authuser'], $this->options['authpass']);
|
||||
|
|
|
@ -246,7 +246,7 @@ class WP_FFPC extends PluginAbstract {
|
|||
{
|
||||
$memcache_protocol = strtolower($memcache_settings['memcache.protocol']['local_value']);
|
||||
if ( $memcache_protocol == 'binary' ) {
|
||||
$this->errors['binary_memcache'] = __('WARNING: Memcache extension is configured to use binary mode. This is very buggy and the plugin will most probably not work correctly. <br />Please consider to change either to ASCII mode or to Memcached extension.', $this->plugin_constant );
|
||||
$this->errors['memcached_binary'] = __('WARNING: Memcache extension is configured to use binary mode. This is very buggy and the plugin will most probably not work correctly. <br />Please consider to change either to ASCII mode or to Memcached extension.', $this->plugin_constant );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -684,6 +684,14 @@ class WP_FFPC extends PluginAbstract {
|
|||
<?php _e('List of backends, with the following syntax: <br />- in case of TCP based connections, list the servers as host1:port1,host2:port2,... . Do not add trailing , and always separate host and port with : .<br />- in2.0.0b1 case using unix sockets with the Memcache driver: unix:// ', $this->plugin_constant); ?></span>
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
<label for="memcached_binary"><?php _e('Enable memcached binary mode', $this->plugin_constant); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="checkbox" name="memcached_binary" id="memcached_binary" value="1" <?php checked($this->options['memcached_binary'],true); ?> />
|
||||
<span class="description"><?php _e('Some memcached proxies and implementations only support the ASCII protocol.', $this->plugin_constant); ?></span>
|
||||
</dd>
|
||||
|
||||
<?php
|
||||
if ( strstr ( $this->options['cache_type'], 'memcached') && extension_loaded ( 'memcached' ) && version_compare( phpversion( 'memcached' ) , '2.0.0', '>=' ) || ( $this->options['cache_type'] == 'redis' ) ) { ?>
|
||||
<?php
|
||||
|
|
|
@ -29,6 +29,7 @@ include_once ( 'wp-ffpc-class.php' );
|
|||
|
||||
$wp_ffpc_defaults = array (
|
||||
'hosts'=>'127.0.0.1:11211',
|
||||
'memcached_binary' => false,
|
||||
'authpass'=>'',
|
||||
'authuser'=>'',
|
||||
'expire'=>300,
|
||||
|
|
Loading…
Reference in a new issue