Skip to content

Commit

Permalink
Compatible with aliyun redis instance
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tourze committed Nov 19, 2022
1 parent debae84 commit c514ed4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,13 @@ private function getRedisEvictionPolicy(): string
foreach ($hosts as $host) {
$info = $host->info('Memory');

if ($info instanceof ErrorInterface) {
if ($info === false || $info === null || $info instanceof ErrorInterface) {
continue;
}

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

return $this->redisEvictionPolicy = $info['maxmemory_policy'];
return $this->redisEvictionPolicy = $info['maxmemory_policy'] ?? '';
}

return $this->redisEvictionPolicy = '';
Expand Down

0 comments on commit c514ed4

Please sign in to comment.