home
/
zktecojo
/
public_html
/
vendor
/
predis
/
predis
/
lib
/
Predis
/
Protocol
/
Text
➕ New
📤 Upload
✎ Editing:
TextCommandSerializer.php
← Back
<?php /* * This file is part of the Predis package. * * (c) Daniele Alessandri <suppakilla@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Predis\Protocol\Text; use Predis\Command\CommandInterface; use Predis\Protocol\CommandSerializerInterface; /** * Implements a pluggable command serializer using the standard wire protocol * defined by Redis. * * @link http://redis.io/topics/protocol * @author Daniele Alessandri <suppakilla@gmail.com> */ class TextCommandSerializer implements CommandSerializerInterface { /** * {@inheritdoc} */ public function serialize(CommandInterface $command) { $commandId = $command->getId(); $arguments = $command->getArguments(); $cmdlen = strlen($commandId); $reqlen = count($arguments) + 1; $buffer = "*{$reqlen}\r\n\${$cmdlen}\r\n{$commandId}\r\n"; for ($i = 0, $reqlen--; $i < $reqlen; $i++) { $argument = $arguments[$i]; $arglen = strlen($argument); $buffer .= "\${$arglen}\r\n{$argument}\r\n"; } return $buffer; } }
💾 Save Changes
Cancel
📤 Upload File
×
Select File
Upload
Cancel
➕ Create New
×
Type
📄 File
📁 Folder
Name
Create
Cancel
✎ Rename Item
×
Current Name
New Name
Rename
Cancel
🔐 Change Permissions
×
Target File
Permission (e.g., 0755, 0644)
0755
0644
0777
Apply
Cancel