1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Dazzle\Redis\Command\Compose; |
4
|
|
|
|
5
|
|
|
use Dazzle\Redis\Command\Builder; |
6
|
|
|
use Dazzle\Redis\Command\Enum; |
7
|
|
|
use Dazzle\Redis\Driver\Request; |
8
|
|
|
|
9
|
|
|
trait ApiClusterTrait |
10
|
|
|
{ |
11
|
|
|
/** |
12
|
|
|
* @param Request $request |
13
|
|
|
* @return mixed |
14
|
|
|
*/ |
15
|
|
|
abstract function dispatch(Request $request); |
|
|
|
|
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @override |
19
|
|
|
* @inheritDoc |
20
|
|
|
*/ |
21
|
|
|
public function clusterAddSlots(...$slots) |
22
|
|
|
{ |
23
|
|
|
// TODO: Implement clusterAddSlots() method. |
24
|
|
|
$command = Enum::CLUSTER_ADDSLOTS; |
25
|
|
|
$args = $slots; |
26
|
|
|
|
27
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @override |
32
|
|
|
* @inheritDoc |
33
|
|
|
*/ |
34
|
|
|
public function clusterCountFailureReports($nodeId) |
35
|
|
|
{ |
36
|
|
|
// TODO: Implement clusterCountFailureReports() method. |
37
|
|
|
$command = Enum::CLUSTER_COUNT_FAILURE_REPORTS; |
38
|
|
|
$args = [$nodeId]; |
39
|
|
|
|
40
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @override |
45
|
|
|
* @inheritDoc |
46
|
|
|
*/ |
47
|
|
|
public function clusterCountKeysInSlot($slot) |
48
|
|
|
{ |
49
|
|
|
// TODO: Implement clusterCountKeysInSlot() method. |
50
|
|
|
$command = Enum::CLUSTER_COUNTKEYSINSLOT; |
51
|
|
|
$args = $slot; |
52
|
|
|
|
53
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @override |
58
|
|
|
* @inheritDoc |
59
|
|
|
*/ |
60
|
|
|
public function clusterDelSlots(...$slots) |
61
|
|
|
{ |
62
|
|
|
// TODO: Implement clusterDelSlots() method. |
63
|
|
|
$command = Enum::CLUSTER_DELSLOTS; |
64
|
|
|
$args = $slots; |
65
|
|
|
|
66
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @override |
71
|
|
|
* @inheritDoc |
72
|
|
|
*/ |
73
|
|
|
public function clusterFailOver($operation) |
|
|
|
|
74
|
|
|
{ |
75
|
|
|
// TODO: Implement clusterFailOver() method. |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @override |
80
|
|
|
* @inheritDoc |
81
|
|
|
*/ |
82
|
|
|
public function clusterForget($nodeId) |
|
|
|
|
83
|
|
|
{ |
84
|
|
|
// TODO: Implement clusterForget() method. |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @override |
89
|
|
|
* @inheritDoc |
90
|
|
|
*/ |
91
|
|
|
public function clusterGetKeyInSlot($slot, $count) |
|
|
|
|
92
|
|
|
{ |
93
|
|
|
// TODO: Implement clusterGetKeyInSlot() method. |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @override |
98
|
|
|
* @inheritDoc |
99
|
|
|
*/ |
100
|
|
|
public function clusterInfo() |
101
|
|
|
{ |
102
|
|
|
// TODO: Implement clusterInfo() method. |
103
|
|
|
$command = Enum::CLUSTER_INFO; |
104
|
|
|
|
105
|
|
|
return $this->dispatch(Builder::build($command)); |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @override |
110
|
|
|
* @inheritDoc |
111
|
|
|
*/ |
112
|
|
View Code Duplication |
public function clusterKeySlot($key) |
|
|
|
|
113
|
|
|
{ |
114
|
|
|
// TODO: Implement clusterKeySlot() method. |
115
|
|
|
$command = Enum::CLUSTER_KEYSLOT; |
116
|
|
|
$args = [$key]; |
117
|
|
|
|
118
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @override |
123
|
|
|
* @inheritDoc |
124
|
|
|
*/ |
125
|
|
|
public function clusterMeet($ip, $port) |
126
|
|
|
{ |
127
|
|
|
// TODO: Implement clusterMeet() method. |
128
|
|
|
$command = Enum::CLUSTER_MEET; |
129
|
|
|
$args = [$ip, $port]; |
130
|
|
|
|
131
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* @override |
136
|
|
|
* @inheritDoc |
137
|
|
|
*/ |
138
|
|
|
public function clusterNodes() |
139
|
|
|
{ |
140
|
|
|
// TODO: Implement clusterNodes() method. |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* @override |
145
|
|
|
* @inheritDoc |
146
|
|
|
*/ |
147
|
|
|
public function clusterReplicate($nodeId) |
|
|
|
|
148
|
|
|
{ |
149
|
|
|
// TODO: Implement clusterReplicate() method. |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* @override |
154
|
|
|
* @inheritDoc |
155
|
|
|
*/ |
156
|
|
|
public function clusterReset($mode) |
|
|
|
|
157
|
|
|
{ |
158
|
|
|
// TODO: Implement clusterReset() method. |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* @override |
163
|
|
|
* @inheritDoc |
164
|
|
|
*/ |
165
|
|
|
public function clusterSaveConfig() |
166
|
|
|
{ |
167
|
|
|
// TODO: Implement clusterSaveConfig() method. |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
/** |
171
|
|
|
* @override |
172
|
|
|
* @inheritDoc |
173
|
|
|
*/ |
174
|
|
|
public function clusterSetConfigEpoch($configEpoch) |
|
|
|
|
175
|
|
|
{ |
176
|
|
|
// TODO: Implement clusterSetConfigEpoch() method. |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* @inheritDoc |
181
|
|
|
*/ |
182
|
|
|
public function clusterSetSlot($command, $nodeId) |
|
|
|
|
183
|
|
|
{ |
184
|
|
|
// TODO: Implement clusterSetSlot() method. |
185
|
|
|
$command = Enum::CLUSTER_SETSLOT; |
186
|
|
|
$args = [$command, $nodeId]; |
187
|
|
|
|
188
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
/** |
192
|
|
|
* @override |
193
|
|
|
* @inheritDoc |
194
|
|
|
*/ |
195
|
|
|
public function clusterSlaves($nodeId) |
196
|
|
|
{ |
197
|
|
|
// TODO: Implement clusterSlaves() method. |
198
|
|
|
$command = Enum::CLUSTER_SLAVES; |
199
|
|
|
$args = [$nodeId]; |
200
|
|
|
|
201
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
202
|
|
|
} |
203
|
|
|
|
204
|
|
|
/** |
205
|
|
|
* @override |
206
|
|
|
* @inheritDoc |
207
|
|
|
*/ |
208
|
|
|
public function clusterSlots() |
209
|
|
|
{ |
210
|
|
|
// TODO: Implement clusterSlots() method. |
211
|
|
|
$command = Enum::CLUSTER_SLOTS; |
212
|
|
|
|
213
|
|
|
return $this->dispatch(Builder::build($command)); |
214
|
|
|
} |
215
|
|
|
|
216
|
|
|
/** |
217
|
|
|
* @override |
218
|
|
|
* @inheritDoc |
219
|
|
|
*/ |
220
|
|
|
public function readOnly() |
221
|
|
|
{ |
222
|
|
|
// TODO: Implement readOnly() method. |
223
|
|
|
$command = Enum::READONLY; |
224
|
|
|
|
225
|
|
|
return $this->dispatch(Builder::build($command)); |
226
|
|
|
} |
227
|
|
|
|
228
|
|
|
/** |
229
|
|
|
* @override |
230
|
|
|
* @inheritDoc |
231
|
|
|
*/ |
232
|
|
|
public function readWrite() |
233
|
|
|
{ |
234
|
|
|
// TODO: Implement readWrite() method. |
235
|
|
|
$command = Enum::READWRITE; |
236
|
|
|
|
237
|
|
|
return $this->dispatch(Builder::build($command)); |
238
|
|
|
} |
239
|
|
|
} |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.