Skip to content

Commit 2b9ed50

Browse files
[Cache] make Redis*Proxy extend Redis*
1 parent 79e48cf commit 2b9ed50

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

Session/Storage/Handler/RedisSessionHandler.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
1313

1414
use Predis\Response\ErrorInterface;
15-
use Symfony\Component\Cache\Traits\RedisClusterProxy;
16-
use Symfony\Component\Cache\Traits\RedisProxy;
1715

1816
/**
1917
* Redis based session storage handler based on the Redis class
@@ -23,8 +21,6 @@
2321
*/
2422
class RedisSessionHandler extends AbstractSessionHandler
2523
{
26-
private \Redis|\RedisArray|\RedisCluster|\Predis\ClientInterface|RedisProxy|RedisClusterProxy $redis;
27-
2824
/**
2925
* Key prefix for shared environments.
3026
*/
@@ -42,13 +38,14 @@ class RedisSessionHandler extends AbstractSessionHandler
4238
*
4339
* @throws \InvalidArgumentException When unsupported client or options are passed
4440
*/
45-
public function __construct(\Redis|\RedisArray|\RedisCluster|\Predis\ClientInterface|RedisProxy|RedisClusterProxy $redis, array $options = [])
46-
{
41+
public function __construct(
42+
private \Redis|\RedisArray|\RedisCluster|\Predis\ClientInterface $redis,
43+
array $options = [],
44+
) {
4745
if ($diff = array_diff(array_keys($options), ['prefix', 'ttl'])) {
4846
throw new \InvalidArgumentException(sprintf('The following options are not supported "%s".', implode(', ', $diff)));
4947
}
5048

51-
$this->redis = $redis;
5249
$this->prefix = $options['prefix'] ?? 'sf_s';
5350
$this->ttl = $options['ttl'] ?? null;
5451
}

Session/Storage/Handler/SessionHandlerFactory.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
use Doctrine\DBAL\DriverManager;
1515
use Symfony\Component\Cache\Adapter\AbstractAdapter;
16-
use Symfony\Component\Cache\Traits\RedisClusterProxy;
17-
use Symfony\Component\Cache\Traits\RedisProxy;
1816

1917
/**
2018
* @author Nicolas Grekas <[email protected]>
@@ -37,8 +35,6 @@ public static function createHandler(object|string $connection, array $options =
3735
case $connection instanceof \RedisArray:
3836
case $connection instanceof \RedisCluster:
3937
case $connection instanceof \Predis\ClientInterface:
40-
case $connection instanceof RedisProxy:
41-
case $connection instanceof RedisClusterProxy:
4238
return new RedisSessionHandler($connection);
4339

4440
case $connection instanceof \Memcached:

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
"symfony/expression-language": "^5.4|^6.0",
3030
"symfony/rate-limiter": "^5.2|^6.0"
3131
},
32+
"conflict": {
33+
"symfony/cache": "<6.2"
34+
},
3235
"suggest" : {
3336
"symfony/mime": "To use the file extension guesser"
3437
},

0 commit comments

Comments
 (0)