Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c514ed4

Browse files
authored
Compatible with aliyun redis instance
Some cloud provider's redis instance is just compatible in common use command, but not some special command. Just like aliyun redis instance, doc: https://help.aliyun.com/document_detail/26342.html It based on redis protocol, but not really like the redis I know... I found that `$host->info('Memory')` will return false/null sometime, so and more safe check will be better for those special redis server.
1 parent debae84 commit c514ed4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,13 +292,13 @@ private function getRedisEvictionPolicy(): string
292292
foreach ($hosts as $host) {
293293
$info = $host->info('Memory');
294294

295-
if ($info instanceof ErrorInterface) {
295+
if ($info === false || $info === null || $info instanceof ErrorInterface) {
296296
continue;
297297
}
298298

299299
$info = $info['Memory'] ?? $info;
300300

301-
return $this->redisEvictionPolicy = $info['maxmemory_policy'];
301+
return $this->redisEvictionPolicy = $info['maxmemory_policy'] ?? '';
302302
}
303303

304304
return $this->redisEvictionPolicy = '';

0 commit comments

Comments
 (0)