@@ -32,13 +32,6 @@ class MemcachedAdapter extends AbstractAdapter
3232
3333protected $ maxIdLength =250 ;
3434
35- private const DEFAULT_CLIENT_OPTIONS = [
36- 'persistent_id ' =>null ,
37- 'username ' =>null ,
38- 'password ' =>null ,
39- \Memcached::OPT_SERIALIZER => \Memcached::SERIALIZER_PHP ,
40- ];
41-
4235private $ marshaller ;
4336private $ client ;
4437private $ lazyClient ;
@@ -106,10 +99,9 @@ public static function createConnection($servers, array $options = [])
10699 }
107100set_error_handler (function ($ type ,$ msg ,$ file ,$ line ) {throw new \ErrorException ($ msg ,0 ,$ type ,$ file ,$ line ); });
108101try {
109- $ options +=static ::DEFAULT_CLIENT_OPTIONS ;
110- $ client =new \Memcached ($ options ['persistent_id ' ]);
111- $ username =$ options ['username ' ];
112- $ password =$ options ['password ' ];
102+ $ client =new \Memcached ($ options ['persistent_id ' ] ??null );
103+ $ username =$ options ['username ' ] ??null ;
104+ $ password =$ options ['password ' ] ??null ;
113105
114106// parse any DSN in $servers
115107foreach ($ serversas $ i =>$ dsn ) {
@@ -180,6 +172,7 @@ public static function createConnection($servers, array $options = [])
180172// set client's options
181173 unset($ options ['persistent_id ' ],$ options ['username ' ],$ options ['password ' ],$ options ['weight ' ],$ options ['lazy ' ]);
182174$ options =array_change_key_case ($ options , \CASE_UPPER );
175+
183176$ client ->setOption (\Memcached::OPT_BINARY_PROTOCOL ,true );
184177$ client ->setOption (\Memcached::OPT_NO_BLOCK ,true );
185178$ client ->setOption (\Memcached::OPT_TCP_NODELAY ,true );
@@ -199,7 +192,7 @@ public static function createConnection($servers, array $options = [])
199192$ options [\constant ('Memcached::OPT_ ' .$ name )] =$ value ;
200193 }
201194 }
202- $ client ->setOptions ($ options );
195+ $ client ->setOptions ($ options + [\Memcached:: OPT_SERIALIZER => \Memcached:: SERIALIZER_PHP ] );
203196
204197// set client's servers, taking care of persistent connections
205198if (!$ client ->isPristine ()) {