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

Appearance settings

Commit 6dc5fea

Browse filesBrowse files
committed
[Cache] Add TLS option for Redis connection
1 parent 44e98db commit 6dc5fea
Copy full SHA for 6dc5fea

File tree

2 files changed

+8
-0
lines changed
Filter options

2 files changed

+8
-0
lines changed

‎src/Symfony/Component/Cache/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
-----
66

77
* added support for connecting to Redis Sentinel clusters when using the Redis PHP extension
8+
* added TLS option for Redis connection
89

910
5.2.0
1011
-----

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Traits/RedisTrait.php
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ trait RedisTrait
4141
'redis_sentinel' => null,
4242
'dbindex' => 0,
4343
'failover' => 'none',
44+
'tls' => false,
4445
];
4546
private $redis;
4647
private $marshaller;
@@ -183,6 +184,12 @@ public static function createConnection($dsn, array $options = [])
183184
$host = $hosts[0]['host'] ?? $hosts[0]['path'];
184185
$port = $hosts[0]['port'] ?? null;
185186

187+
$tls = filter_var($params['tls'], \FILTER_VALIDATE_BOOLEAN);
188+
189+
if (true === $tls) {
190+
$host = 'tls://'.$host;
191+
}
192+
186193
if (isset($params['redis_sentinel'])) {
187194
$sentinel = new \RedisSentinel($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout']);
188195

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.