Debian Codegraph @

vendor/clue/redis-protocol/src/Clue/Redis/Protocol/Serializer/SerializerInterface.php

raw
1 <?php
2
3 namespace Clue\Redis\Protocol\Serializer;
4
5 use Clue\Redis\Protocol\Model\ErrorReplyException;
6 use Clue\Redis\Protocol\Model\ModelInterface;
7 use Clue\Redis\Protocol\Model\MultiBulkReply;
8
9 interface SerializerInterface
10 {
11 /**
12 * create a serialized unified request protocol message
13 *
14 * This is the *one* method most redis client libraries will likely want to
15 * use in order to send a serialized message (a request) over the* wire to
16 * your redis server instance.
17 *
18 * This method should be used in favor of constructing a request model and
19 * then serializing it. While its effect might be equivalent, this method
20 * is likely to (i.e. it /could/) provide a faster implementation.
21 *
22 * @param string $command
23 * @param array $args
24 * @return string
25 * @see self::createRequestMessage()
26 */
27 public function getRequestMessage($command, array $args = array());
28
29 /**
30 * create a unified request protocol message model
31 *
32 * @param string $command
33 * @param array $args
34 * @return MultiBulkReply
35 */
36 public function createRequestModel($command, array $args = array());
37
38 /**
39 * create a serialized unified protocol reply message
40 *
41 * This is most useful for a redis server implementation which needs to
42 * process client requests and send resulting reply messages.
43 *
44 * This method does its best to guess to right reply type and then returns
45 * a serialized version of the message. It follows the "redis to lua
46 * conversion table" (see link) which means most basic types can be mapped
47 * as is.
48 *
49 * This method should be used in favor of constructing a reply model and
50 * then serializing it. While its effect might be equivalent, this method
51 * is likely to (i.e. it /could/) provide a faster implementation.
52 *
53 * Note however, you may still want to explicitly create a nested reply
54 * model hierarchy if you need more control over the serialized message. For
55 * instance, a null value will always be returned as a Null-Bulk-Reply, so
56 * there's no way to express a Null-Multi-Bulk-Reply, unless you construct
57 * it explicitly.
58 *
59 * @param mixed $data
60 * @return string
61 * @see self::createReplyModel()
62 * @link http://redis.io/commands/eval
63 */
64 public function getReplyMessage($data);
65
66 /**
67 * create response message by determining datatype from given argument
68 *
69 * @param mixed $data
70 * @return ModelInterface
71 */
72 public function createReplyModel($data);
73
74 public function getBulkMessage($data);
75
76 public function getErrorMessage($data);
77
78 public function getIntegerMessage($data);
79
80 public function getMultiBulkMessage($data);
81
82 public function getStatusMessage($data);
83 }