Merge branch '5.0' into 5.1
* 5.0: Allows RedisClusterProxy instance in Lock RedisStore
This commit is contained in:
commit
ef1566e999
@ -84,7 +84,7 @@ trait RedisTrait
|
||||
*
|
||||
* @throws InvalidArgumentException when the DSN is invalid
|
||||
*
|
||||
* @return \Redis|\RedisCluster|\Predis\ClientInterface According to the "class" option
|
||||
* @return \Redis|\RedisCluster|RedisClusterProxy|RedisProxy|\Predis\ClientInterface According to the "class" option
|
||||
*/
|
||||
public static function createConnection($dsn, array $options = [])
|
||||
{
|
||||
|
@ -32,13 +32,13 @@ class RedisStore implements PersistingStoreInterface
|
||||
private $initialTtl;
|
||||
|
||||
/**
|
||||
* @param \Redis|\RedisArray|\RedisCluster|\Predis\ClientInterface $redisClient
|
||||
* @param float $initialTtl the expiration delay of locks in seconds
|
||||
* @param \Redis|\RedisArray|\RedisCluster|RedisProxy|RedisClusterProxy\Predis\ClientInterface $redisClient
|
||||
* @param float $initialTtl the expiration delay of locks in seconds
|
||||
*/
|
||||
public function __construct($redisClient, float $initialTtl = 300.0)
|
||||
{
|
||||
if (!$redisClient instanceof \Redis && !$redisClient instanceof \RedisArray && !$redisClient instanceof \RedisCluster && !$redisClient instanceof \Predis\ClientInterface && !$redisClient instanceof RedisProxy) {
|
||||
throw new InvalidArgumentException(sprintf('"%s()" expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\ClientInterface, "%s" given.', __METHOD__, get_debug_type($redisClient)));
|
||||
if (!$redisClient instanceof \Redis && !$redisClient instanceof \RedisArray && !$redisClient instanceof \RedisCluster && !$redisClient instanceof \Predis\ClientInterface && !$redisClient instanceof RedisProxy && !$redisClient instanceof RedisClusterProxy) {
|
||||
throw new InvalidArgumentException(sprintf('"%s()" expects parameter 1 to be Redis, RedisArray, RedisCluster, RedisProxy, RedisClusterProxy or Predis\ClientInterface, "%s" given.', __METHOD__, get_debug_type($redisClient)));
|
||||
}
|
||||
|
||||
if ($initialTtl <= 0) {
|
||||
|
@ -66,6 +66,9 @@ class StoreFactoryTest extends TestCase
|
||||
}
|
||||
if (class_exists(\Redis::class) && class_exists(AbstractAdapter::class)) {
|
||||
yield ['redis://localhost', RedisStore::class];
|
||||
yield ['redis://localhost?lazy=1', RedisStore::class];
|
||||
yield ['redis://localhost?redis_cluster=1', RedisStore::class];
|
||||
yield ['redis://localhost?redis_cluster=1&lazy=1', RedisStore::class];
|
||||
}
|
||||
if (class_exists(\PDO::class)) {
|
||||
yield ['sqlite:/tmp/sqlite.db', PdoStore::class];
|
||||
|
Reference in New Issue
Block a user