Skip to content

Commit

Permalink
[Cache] 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 authored and nicolas-grekas committed Jan 26, 2023
1 parent debae84 commit 9ab2435
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 (false === $info || null === $info || $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 9ab2435

Please sign in to comment.