* - 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.
+ * - use_binary_protocol Whether to enable the binary protocol (default is ASCII) (boolean)
* @param array $params
* @throws InvalidArgumentException
*/
$this->client = new Memcached;
}
- if ( !isset( $params['serializer'] ) ) {
- $params['serializer'] = 'php';
+ if ( $params['use_binary_protocol'] ) {
+ $this->client->setOption( Memcached::OPT_BINARY_PROTOCOL, true );
}
if ( isset( $params['retry_timeout'] ) ) {
$this->client->addServers( $servers );
}
+ protected function applyDefaultParams( $params ) {
+ $params = parent::applyDefaultParams( $params );
+
+ if ( !isset( $params['use_binary_protocol'] ) ) {
+ $params['use_binary_protocol'] = false;
+ }
+
+ if ( !isset( $params['serializer'] ) ) {
+ $params['serializer'] = 'php';
+ }
+
+ return $params;
+ }
+
protected function getWithToken( $key, &$casToken, $flags = 0 ) {
$this->debugLog( "get($key)" );
$result = $this->client->get( $this->validateKeyEncoding( $key ), null, $casToken );