8000 [Cache] Enforce usage of Predis with Sentinel · symfony/symfony@9789ecd · GitHub
[go: up one dir, main page]

Skip to content

Commit 9789ecd

Browse files
authored
[Cache] Enforce usage of Predis with Sentinel
Enforce usage of \Predis\Client when the Sentinel option is enabled
1 parent 1a7fa5d commit 9789ecd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Symfony/Component/Cache/Traits/RedisTrait.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,10 @@ public static function createConnection($dsn, array $options = [])
178178
$class = $params['redis_cluster'] ? \RedisCluster::class : (1 < \count($hosts) ? \RedisArray::class : \Redis::class);
179179
} else {
180180
$class = $params['class'] ?? \Predis\Client::class;
181+
182+
if (isset($params['redis_sentinel']) && !is_a($class, \Predis\Client::class, true)) {
183+
throw new CacheException(sprintf('Redis Sentinel requires the use of \Predis\Client as class: "%s".', $dsn));
184+
}
181185
}
182186

183187
if (is_a($class, \Redis::class, true)) {

0 commit comments

Comments
 (0)
0