-
Notifications
You must be signed in to change notification settings - Fork 959
/
RedisServerCommands.java
425 lines (373 loc) · 11.4 KB
/
RedisServerCommands.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
/*
* Copyright 2017-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.lettuce.core.api.sync;
import java.util.Date;
import java.util.List;
import java.util.Map;
import io.lettuce.core.FlushMode;
import io.lettuce.core.KillArgs;
import io.lettuce.core.TrackingArgs;
import io.lettuce.core.UnblockType;
import io.lettuce.core.protocol.CommandType;
/**
* Synchronous executed commands for Server Control.
*
* @param <K> Key type.
* @param <V> Value type.
* @author Mark Paluch
* @since 4.0
* @generated by io.lettuce.apigenerator.CreateSyncApi
*/
public interface RedisServerCommands<K, V> {
/**
* Asynchronously rewrite the append-only file.
*
* @return String simple-string-reply always {@code OK}.
*/
String bgrewriteaof();
/**
* Asynchronously save the dataset to disk.
*
* @return String simple-string-reply.
*/
String bgsave();
/**
* Control tracking of keys in the context of server-assisted client cache invalidation.
*
* @param enabled {@code true} to enable key tracking.
* @return String simple-string-reply {@code OK}.
* @since 6.0
*/
String clientCaching(boolean enabled);
/**
* Get the current connection name.
*
* @return K bulk-string-reply The connection name, or a null bulk reply if no name is set.
*/
K clientGetname();
/**
* Returns the client ID we are redirecting our tracking notifications to.
*
* @return the ID of the client we are redirecting the notifications to. The command returns -1 if client tracking is not
* enabled, or 0 if client tracking is enabled but we are not redirecting the notifications to any client.
* @since 6.0
*/
Long clientGetredir();
/**
* Get the id of the current connection.
*
* @return Long The command just returns the ID of the current connection.
* @since 5.3
*/
Long clientId();
/**
* Kill the connection of a client identified by ip:port.
*
* @param addr ip:port.
* @return String simple-string-reply {@code OK} if the connection exists and has been closed.
*/
String clientKill(String addr);
/**
* Kill connections of clients which are filtered by {@code killArgs}.
*
* @param killArgs args for the kill operation.
* @return Long integer-reply number of killed connections.
*/
Long clientKill(KillArgs killArgs);
/**
* Get the list of client connections.
*
* @return String bulk-string-reply a unique string, formatted as follows: One client connection per line (separated by LF),
* each line is composed of a succession of property=value fields separated by a space character.
*/
String clientList();
/**
* Stop processing commands from clients for some time.
*
* @param timeout the timeout value in milliseconds.
* @return String simple-string-reply The command returns OK or an error if the timeout is invalid.
*/
String clientPause(long timeout);
/**
* Set the current connection name.
*
* @param name the client name.
* @return simple-string-reply {@code OK} if the connection name was successfully set.
*/
String clientSetname(K name);
/**
* Enables the tracking feature of the Redis server, that is used for server assisted client side caching. Tracking messages
* are either available when using the RESP3 protocol or through Pub/Sub notification when using RESP2.
*
* @param args for the CLIENT TRACKING operation.
* @return String simple-string-reply {@code OK}.
* @since 6.0
*/
String clientTracking(TrackingArgs args);
/**
* Unblock the specified blocked client.
*
* @param id the client id.
* @param type unblock type.
* @return Long integer-reply number of unblocked connections.
* @since 5.1
*/
Long clientUnblock(long id, UnblockType type);
/**
* Returns an array reply of details about all Redis commands.
*
* @return List<Object> array-reply.
*/
List<Object> command();
/**
* Get total number of Redis commands.
*
* @return Long integer-reply of number of total commands in this Redis server.
*/
Long commandCount();
/**
* Returns an array reply of details about the requested commands.
*
* @param commands the commands to query for.
* @return List<Object> array-reply.
*/
List<Object> commandInfo(String... commands);
/**
* Returns an array reply of details about the requested commands.
*
* @param commands the commands to query for.
* @return List<Object> array-reply.
*/
List<Object> commandInfo(CommandType... commands);
/**
* Get the value of a configuration parameter.
*
* @param parameter name of the parameter.
* @return Map<String, String> bulk-string-reply.
*/
Map<String, String> configGet(String parameter);
/**
* Reset the stats returned by INFO.
*
* @return String simple-string-reply always {@code OK}.
*/
String configResetstat();
/**
* Rewrite the configuration file with the in memory configuration.
*
* @return String simple-string-reply {@code OK} when the configuration was rewritten properly. Otherwise an error is
* returned.
*/
String configRewrite();
/**
* Set a configuration parameter to the given value.
*
* @param parameter the parameter name.
* @param value the parameter value.
* @return String simple-string-reply: {@code OK} when the configuration was set properly. Otherwise an error is returned.
*/
String configSet(String parameter, String value);
/**
* Return the number of keys in the selected database.
*
* @return Long integer-reply.
*/
Long dbsize();
/**
* Crash and recover.
*
* @param delay optional delay in milliseconds.
* @return String simple-string-reply.
*/
String debugCrashAndRecover(Long delay);
/**
* Get debugging information about the internal hash-table state.
*
* @param db the database number.
* @return String simple-string-reply.
*/
String debugHtstats(int db);
/**
* Get debugging information about a key.
*
* @param key the key.
* @return String simple-string-reply.
*/
String debugObject(K key);
/**
* Make the server crash: Out of memory.
*
* @return nothing, because the server crashes before returning.
*/
void debugOom();
/**
* Save RDB, clear the database and reload RDB.
*
* @return String simple-string-reply The commands returns OK on success.
*/
String debugReload();
/**
* Restart the server gracefully.
*
* @param delay optional delay in milliseconds.
* @return String simple-string-reply.
*/
String debugRestart(Long delay);
/**
* Get debugging information about the internal SDS length.
*
* @param key the key.
* @return String simple-string-reply.
*/
String debugSdslen(K key);
/**
* Make the server crash: Invalid pointer access.
*
* @return nothing, because the server crashes before returning.
*/
void debugSegfault();
/**
* Remove all keys from all databases.
*
* @return String simple-string-reply.
*/
String flushall();
/**
* Remove all keys from all databases using the specified {@link FlushMode}.
*
* @param flushMode the flush mode (sync/async).
* @return String simple-string-reply.
* @since 6.1
*/
String flushall(FlushMode flushMode);
/**
* Remove all keys asynchronously from all databases.
*
* @return String simple-string-reply.
* @deprecated since 6.1, use {@link #flushall(FlushMode)} instead.
*/
@Deprecated
String flushallAsync();
/**
* Remove all keys from the current database.
*
* @return String simple-string-reply.
*/
String flushdb();
/**
* Remove all keys from the current database using the specified {@link FlushMode}.
*
* @param flushMode the flush mode (sync/async).
* @return String simple-string-reply.
* @since 6.1
*/
String flushdb(FlushMode flushMode);
/**
* Remove all keys asynchronously from the current database.
*
* @return String simple-string-reply.
* @deprecated since 6.1, use {@link #flushdb(FlushMode)} instead.
*/
@Deprecated
String flushdbAsync();
/**
* Get information and statistics about the server.
*
* @return String bulk-string-reply as a collection of text lines.
*/
String info();
/**
* Get information and statistics about the server.
*
* @param section the section type: string.
* @return String bulk-string-reply as a collection of text lines.
*/
String info(String section);
/**
* Get the UNIX time stamp of the last successful save to disk.
*
* @return Date integer-reply an UNIX time stamp.
*/
Date lastsave();
/**
* Reports the number of bytes that a key and its value require to be stored in RAM.
*
* @return memory usage in bytes.
* @since 5.2
*/
Long memoryUsage(K key);
/**
* Synchronously save the dataset to disk.
*
* @return String simple-string-reply The commands returns OK on success.
*/
String save();
/**
* Synchronously save the dataset to disk and then shut down the server.
*
* @param save {@code true} force save operation.
*/
void shutdown(boolean save);
/**
* Make the server a replica of another instance, or promote it as master.
*
* @param host the host type: string.
* @param port the port type: string.
* @return String simple-string-reply.
*/
String slaveof(String host, int port);
/**
* Promote server as master.
*
* @return String simple-string-reply.
*/
String slaveofNoOne();
/**
* Read the slow log.
*
* @return List<Object> deeply nested multi bulk replies.
*/
List<Object> slowlogGet();
/**
* Read the slow log.
*
* @param count the count.
* @return List<Object> deeply nested multi bulk replies.
*/
List<Object> slowlogGet(int count);
/**
* Obtaining the current length of the slow log.
*
* @return Long length of the slow log.
*/
Long slowlogLen();
/**
* Resetting the slow log.
*
* @return String simple-string-reply The commands returns OK on success.
*/
String slowlogReset();
/**
* Return the current server time.
*
* @return List<V> array-reply specifically:
*
* A multi bulk reply containing two elements:
*
* unix time in seconds. microseconds.
*/
List<V> time();
}