-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Cache] fix compatibility with redis extension 6.0.3+ #57885
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Cache\Traits; | ||
|
||
if (version_compare(phpversion('redis'), '6.1.0', '>=')) { | ||
/** | ||
* @internal | ||
*/ | ||
trait Redis6ProxyTrait | ||
{ | ||
public function dump($key): \Redis|string|false | ||
{ | ||
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->dump(...\func_get_args()); | ||
} | ||
|
||
public function hRandField($key, $options = null): \Redis|array|string|false | ||
{ | ||
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hRandField(...\func_get_args()); | ||
} | ||
|
||
public function hSet($key, $fields_and_vals): \Redis|false|int | ||
Check failure on line 30 in src/Symfony/Component/Cache/Traits/Redis6ProxyTrait.php
|
||
{ | ||
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hSet(...\func_get_args()); | ||
} | ||
|
||
public function mget($keys): \Redis|array|false | ||
{ | ||
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->mget(...\func_get_args()); | ||
} | ||
|
||
public function sRandMember($key, $count = 0): mixed | ||
{ | ||
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sRandMember(...\func_get_args()); | ||
} | ||
|
||
public function waitaof($numlocal, $numreplicas, $timeout): \Redis|array|false | ||
{ | ||
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->waitaof(...\func_get_args()); | ||
} | ||
} | ||
} else { | ||
/** | ||
* @internal | ||
*/ | ||
trait Redis6ProxyTrait | ||
Check failure on line 54 in src/Symfony/Component/Cache/Traits/Redis6ProxyTrait.php
|
||
{ | ||
public function dump($key): \Redis|string | ||
Check failure on line 56 in src/Symfony/Component/Cache/Traits/Redis6ProxyTrait.php
|
||
{ | ||
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->dump(...\func_get_args()); | ||
} | ||
|
||
public function hRandField($key, $options = null): \Redis|array|string | ||
{ | ||
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hRandField(...\func_get_args()); | ||
} | ||
|
||
public function hSet($key, $member, $value): \Redis|false|int | ||
Check failure on line 66 in src/Symfony/Component/Cache/Traits/Redis6ProxyTrait.php
|
||
{ | ||
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hSet(...\func_get_args()); | ||
} | ||
|
||
public function mget($keys): \Redis|array | ||
{ | ||
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->mget(...\func_get_args()); | ||
} | ||
|
||
public function sRandMember($key, $count = 0): \Redis|array|false|string | ||
Check failure on line 76 in src/Symfony/Component/Cache/Traits/Redis6ProxyTrait.php
|
||
{ | ||
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sRandMember(...\func_get_args()); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Cache\Traits; | ||
|
||
if (version_compare(phpversion('redis'), '6.1.0', '>')) { | ||
/** | ||
* @internal | ||
*/ | ||
trait RedisCluster6ProxyTrait | ||
{ | ||
public function getex($key, $options = []): \RedisCluster|string|false | ||
{ | ||
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getex(...\func_get_args()); | ||
} | ||
|
||
public function publish($channel, $message): \RedisCluster|bool|int | ||
{ | ||
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->publish(...\func_get_args()); | ||
} | ||
|
||
public function waitaof($key_or_address, $numlocal, $numreplicas, $timeout): \RedisCluster|array|false | ||
{ | ||
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->waitaof(...\func_get_args()); | ||
} | ||
} | ||
} else { | ||
/** | ||
* @internal | ||
*/ | ||
trait RedisCluster6ProxyTrait | ||
Check failure on line 39 in src/Symfony/Component/Cache/Traits/RedisCluster6ProxyTrait.php
|
||
{ | ||
public function publish($channel, $message): \RedisCluster|bool | ||
{ | ||
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->publish(...\func_get_args()); | ||
} | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.