Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf9312fd

Browse files
[Cache] fix trying to load Memcached before checking we can
1 parent7f3e387 commitf9312fd

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

‎src/Symfony/Component/Cache/Adapter/MemcachedAdapter.php‎

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,6 @@ class MemcachedAdapter extends AbstractAdapter
3232

3333
protected$maxIdLength =250;
3434

35-
privateconstDEFAULT_CLIENT_OPTIONS = [
36-
'persistent_id' =>null,
37-
'username' =>null,
38-
'password' =>null,
39-
\Memcached::OPT_SERIALIZER => \Memcached::SERIALIZER_PHP,
40-
];
41-
4235
private$marshaller;
4336
private$client;
4437
private$lazyClient;
@@ -106,10 +99,9 @@ public static function createConnection($servers, array $options = [])
10699
}
107100
set_error_handler(function ($type,$msg,$file,$line) {thrownew \ErrorException($msg,0,$type,$file,$line); });
108101
try {
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
115107
foreach ($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
205198
if (!$client->isPristine()) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp