-
-
Notifications
You must be signed in to change notification settings - Fork 980
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added support for new arguments for BITPOS, BITCOUNT commands (#1045) * Added support for new arguments for EXPIRE, EXPIREAT commands (#1046) * Extended core support by implementing SORT_RO command (#1044) * Added support for SORT_RO command * Codestyle fixes * Added command description --------- Co-authored-by: Vladyslav Vildanov <vladyslavvildanov@Vladyslav-Vildanov-MacBook-Pro.local> * fix deprecated call * Added support for container commands (#1049) * Added support for container commands FUNCTION LOAD, FUNCTION DELETE and FCALL * Changed ContainerInterface and AbstractContainer * Re-implement logic of abstract methods --------- Co-authored-by: Vladyslav Vildanov <vladyslavvildanov@Vladyslav-Vildanov-MacBook-Pro.local> * Added stream commands to KeyPrefixProcessor (#1051) Co-authored-by: Vladyslav Vildanov <vladyslavvildanov@Vladyslav-Vildanov-MacBook-Pro.local> * Fix return type of ReplicationInterface::getSlaves (#1111) * Codestyle fixes * Changed return annotation --------- Co-authored-by: Vladyslav Vildanov <vladyslavvildanov@Vladyslav-Vildanov-MacBook-Pro.local> Co-authored-by: Till Krüss <till@kruss.io> Co-authored-by: Stephan <glaubinix@users.noreply.github.com>
- Loading branch information
1 parent
02fadf8
commit bc5f07d
Showing
53 changed files
with
2,126 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Predis package. | ||
* | ||
* (c) 2009-2020 Daniele Alessandri | ||
* (c) 2021-2023 Till Krüss | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Predis\Command\Argument\Server; | ||
|
||
use Predis\Command\Argument\ArrayableArgument; | ||
|
||
interface LimitInterface extends ArrayableArgument | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Predis package. | ||
* | ||
* (c) 2009-2020 Daniele Alessandri | ||
* (c) 2021-2023 Till Krüss | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Predis\Command\Argument\Server; | ||
|
||
class LimitOffsetCount implements LimitInterface | ||
{ | ||
private const KEYWORD = 'LIMIT'; | ||
|
||
/** | ||
* @var int | ||
*/ | ||
private $offset; | ||
|
||
/** | ||
* @var int | ||
*/ | ||
private $count; | ||
|
||
public function __construct(int $offset, int $count) | ||
{ | ||
$this->offset = $offset; | ||
$this->count = $count; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function toArray(): array | ||
{ | ||
return [self::KEYWORD, $this->offset, $this->count]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Predis package. | ||
* | ||
* (c) 2009-2020 Daniele Alessandri | ||
* (c) 2021-2023 Till Krüss | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Predis\Command\Redis\Container; | ||
|
||
use Predis\ClientInterface; | ||
|
||
abstract class AbstractContainer implements ContainerInterface | ||
{ | ||
/** | ||
* @var ClientInterface | ||
*/ | ||
protected $client; | ||
|
||
public function __construct(ClientInterface $client) | ||
{ | ||
$this->client = $client; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function __call($subcommandID, $arguments) | ||
{ | ||
array_unshift($arguments, strtoupper($subcommandID)); | ||
|
||
return $this->client->executeCommand( | ||
$this->client->createCommand($this->getContainerCommandId(), $arguments) | ||
); | ||
} | ||
|
||
abstract public function getContainerCommandId(): string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Predis package. | ||
* | ||
* (c) 2009-2020 Daniele Alessandri | ||
* (c) 2021-2023 Till Krüss | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Predis\Command\Redis\Container; | ||
|
||
use Predis\ClientInterface; | ||
use UnexpectedValueException; | ||
|
||
class ContainerFactory | ||
{ | ||
private const CONTAINER_NAMESPACE = "Predis\Command\Redis\Container"; | ||
|
||
/** | ||
* Mappings for class names that corresponds to PHP reserved words. | ||
* | ||
* @var array | ||
*/ | ||
private static $specialMappings = [ | ||
'FUNCTION' => FunctionContainer::class, | ||
]; | ||
|
||
/** | ||
* Creates container command. | ||
* | ||
* @param ClientInterface $client | ||
* @param string $containerCommandID | ||
* @return ContainerInterface | ||
*/ | ||
public static function create(ClientInterface $client, string $containerCommandID): ContainerInterface | ||
{ | ||
$containerCommandID = strtoupper($containerCommandID); | ||
|
||
if (class_exists($containerClass = self::CONTAINER_NAMESPACE . '\\' . $containerCommandID)) { | ||
return new $containerClass($client); | ||
} | ||
|
||
if (array_key_exists($containerCommandID, self::$specialMappings)) { | ||
$containerClass = self::$specialMappings[$containerCommandID]; | ||
|
||
return new $containerClass($client); | ||
} | ||
|
||
throw new UnexpectedValueException('Given command is not supported.'); | ||
} | ||
} |
Oops, something went wrong.