forked from redis/jedis
/
JedisCommands.java
488 lines (321 loc) · 13.3 KB
/
JedisCommands.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
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
package redis.clients.jedis.commands;
import java.util.List;
import java.util.Map;
import java.util.Set;
import redis.clients.jedis.BitPosParams;
import redis.clients.jedis.StreamEntryID;
import redis.clients.jedis.GeoCoordinate;
import redis.clients.jedis.GeoRadiusResponse;
import redis.clients.jedis.GeoUnit;
import redis.clients.jedis.ListPosition;
import redis.clients.jedis.StreamPendingEntry;
import redis.clients.jedis.ScanParams;
import redis.clients.jedis.ScanResult;
import redis.clients.jedis.SortingParams;
import redis.clients.jedis.StreamEntry;
import redis.clients.jedis.Tuple;
import redis.clients.jedis.params.GeoRadiusParam;
import redis.clients.jedis.params.SetParams;
import redis.clients.jedis.params.ZAddParams;
import redis.clients.jedis.params.ZIncrByParams;
/**
* Common interface for sharded and non-sharded Jedis
*/
public interface JedisCommands {
String set(String key, String value);
String set(String key, String value, SetParams params);
String get(String key);
Boolean exists(String key);
Long persist(String key);
String type(String key);
byte[] dump(String key);
String restore(String key, int ttl, byte[] serializedValue);
String restoreReplace(String key, int ttl, byte[] serializedValue);
Long expire(String key, int seconds);
Long pexpire(String key, long milliseconds);
Long expireAt(String key, long unixTime);
Long pexpireAt(String key, long millisecondsTimestamp);
Long ttl(String key);
Long pttl(String key);
Long touch(String key);
Boolean setbit(String key, long offset, boolean value);
Boolean setbit(String key, long offset, String value);
Boolean getbit(String key, long offset);
Long setrange(String key, long offset, String value);
String getrange(String key, long startOffset, long endOffset);
String getSet(String key, String value);
Long setnx(String key, String value);
String setex(String key, int seconds, String value);
String psetex(String key, long milliseconds, String value);
Long decrBy(String key, long decrement);
Long decr(String key);
Long incrBy(String key, long increment);
Double incrByFloat(String key, double increment);
Long incr(String key);
Long append(String key, String value);
String substr(String key, int start, int end);
Long hset(String key, String field, String value);
Long hset(String key, Map<String, String> hash);
String hget(String key, String field);
Long hsetnx(String key, String field, String value);
String hmset(String key, Map<String, String> hash);
List<String> hmget(String key, String... fields);
Long hincrBy(String key, String field, long value);
Double hincrByFloat(String key, String field, double value);
Boolean hexists(String key, String field);
Long hdel(String key, String... field);
Long hlen(String key);
Set<String> hkeys(String key);
List<String> hvals(String key);
Map<String, String> hgetAll(String key);
Long rpush(String key, String... string);
Long lpush(String key, String... string);
Long llen(String key);
List<String> lrange(String key, long start, long stop);
String ltrim(String key, long start, long stop);
String lindex(String key, long index);
String lset(String key, long index, String value);
Long lrem(String key, long count, String value);
String lpop(String key);
String rpop(String key);
Long sadd(String key, String... member);
Set<String> smembers(String key);
Long srem(String key, String... member);
String spop(String key);
Set<String> spop(String key, long count);
Long scard(String key);
Boolean sismember(String key, String member);
String srandmember(String key);
List<String> srandmember(String key, int count);
Long strlen(String key);
Long zadd(String key, double score, String member);
Long zadd(String key, double score, String member, ZAddParams params);
Long zadd(String key, Map<String, Double> scoreMembers);
Long zadd(String key, Map<String, Double> scoreMembers, ZAddParams params);
Set<String> zrange(String key, long start, long stop);
Long zrem(String key, String... members);
Double zincrby(String key, double increment, String member);
Double zincrby(String key, double increment, String member, ZIncrByParams params);
Long zrank(String key, String member);
Long zrevrank(String key, String member);
Set<String> zrevrange(String key, long start, long stop);
Set<Tuple> zrangeWithScores(String key, long start, long stop);
Set<Tuple> zrevrangeWithScores(String key, long start, long stop);
Long zcard(String key);
Double zscore(String key, String member);
Set<Tuple> zpopmin(String key);
Set<Tuple> zpopmin(String key, long count);
List<String> sort(String key);
List<String> sort(String key, SortingParams sortingParameters);
Long zcount(String key, double min, double max);
Long zcount(String key, String min, String max);
Set<String> zrangeByScore(String key, double min, double max);
Set<String> zrangeByScore(String key, String min, String max);
Set<String> zrevrangeByScore(String key, double max, double min);
Set<String> zrangeByScore(String key, double min, double max, int offset, int count);
Set<String> zrevrangeByScore(String key, String max, String min);
Set<String> zrangeByScore(String key, String min, String max, int offset, int count);
Set<String> zrevrangeByScore(String key, double max, double min, int offset, int count);
Set<Tuple> zrangeByScoreWithScores(String key, double min, double max);
Set<Tuple> zrevrangeByScoreWithScores(String key, double max, double min);
Set<Tuple> zrangeByScoreWithScores(String key, double min, double max, int offset, int count);
Set<String> zrevrangeByScore(String key, String max, String min, int offset, int count);
Set<Tuple> zrangeByScoreWithScores(String key, String min, String max);
Set<Tuple> zrevrangeByScoreWithScores(String key, String max, String min);
Set<Tuple> zrangeByScoreWithScores(String key, String min, String max, int offset, int count);
Set<Tuple> zrevrangeByScoreWithScores(String key, double max, double min, int offset, int count);
Set<Tuple> zrevrangeByScoreWithScores(String key, String max, String min, int offset, int count);
Long zremrangeByRank(String key, long start, long stop);
Long zremrangeByScore(String key, double min, double max);
Long zremrangeByScore(String key, String min, String max);
Long zlexcount(String key, String min, String max);
Set<String> zrangeByLex(String key, String min, String max);
Set<String> zrangeByLex(String key, String min, String max, int offset,
int count);
Set<String> zrevrangeByLex(String key, String max, String min);
Set<String> zrevrangeByLex(String key, String max, String min,
int offset, int count);
Long zremrangeByLex(String key, String min, String max);
Long linsert(String key, ListPosition where, String pivot, String value);
Long lpushx(String key, String... string);
Long rpushx(String key, String... string);
List<String> blpop(int timeout, String key);
List<String> brpop(int timeout, String key);
Long del(String key);
Long unlink(String key);
String echo(String string);
Long move(String key, int dbIndex);
Long bitcount(String key);
Long bitcount(String key, long start, long end);
Long bitpos(String key, boolean value);
Long bitpos(String key, boolean value, BitPosParams params);
ScanResult<Map.Entry<String, String>> hscan(String key, String cursor);
ScanResult<Map.Entry<String, String>> hscan(String key, String cursor,
ScanParams params);
ScanResult<String> sscan(String key, String cursor);
ScanResult<Tuple> zscan(String key, String cursor);
ScanResult<Tuple> zscan(String key, String cursor, ScanParams params);
ScanResult<String> sscan(String key, String cursor, ScanParams params);
Long pfadd(String key, String... elements);
long pfcount(String key);
// Geo Commands
Long geoadd(String key, double longitude, double latitude, String member);
Long geoadd(String key, Map<String, GeoCoordinate> memberCoordinateMap);
Double geodist(String key, String member1, String member2);
Double geodist(String key, String member1, String member2, GeoUnit unit);
List<String> geohash(String key, String... members);
List<GeoCoordinate> geopos(String key, String... members);
List<GeoRadiusResponse> georadius(String key, double longitude, double latitude, double radius,
GeoUnit unit);
List<GeoRadiusResponse> georadiusReadonly(String key, double longitude, double latitude, double radius,
GeoUnit unit);
List<GeoRadiusResponse> georadius(String key, double longitude, double latitude, double radius,
GeoUnit unit, GeoRadiusParam param);
List<GeoRadiusResponse> georadiusReadonly(String key, double longitude, double latitude, double radius,
GeoUnit unit, GeoRadiusParam param);
List<GeoRadiusResponse> georadiusByMember(String key, String member, double radius, GeoUnit unit);
List<GeoRadiusResponse> georadiusByMemberReadonly(String key, String member, double radius, GeoUnit unit);
List<GeoRadiusResponse> georadiusByMember(String key, String member, double radius, GeoUnit unit,
GeoRadiusParam param);
List<GeoRadiusResponse> georadiusByMemberReadonly(String key, String member, double radius, GeoUnit unit,
GeoRadiusParam param);
/**
* Executes BITFIELD Redis command
* @param key
* @param arguments
* @return
*/
List<Long> bitfield(String key, String...arguments);
/**
* Used for HSTRLEN Redis command
* @param key
* @param field
* @return length of the value for key
*/
Long hstrlen(String key, String field);
/**
* XADD key ID field string [field string ...]
*
* @param key
* @param id
* @param hash
* @return the ID of the added entry
*/
StreamEntryID xadd(String key, StreamEntryID id, Map<String, String> hash);
/**
* XADD key MAXLEN ~ LEN ID field string [field string ...]
*
* @param key
* @param id
* @param hash
* @param maxLen
* @param approximateLength
* @return
*/
StreamEntryID xadd(String key, StreamEntryID id, Map<String, String> hash, long maxLen, boolean approximateLength);
/**
* XLEN key
*
* @param key
* @return
*/
Long xlen(String key);
/**
* XRANGE key start end [COUNT count]
*
* @param key
* @param start minimum {@link StreamEntryID} for the retrieved range, passing <code>null</code> will indicate minimum ID possible in the stream
* @param end maximum {@link StreamEntryID} for the retrieved range, passing <code>null</code> will indicate maximum ID possible in the stream
* @param count maximum number of entries returned
* @return The entries with IDs matching the specified range.
*/
List<StreamEntry> xrange(String key, StreamEntryID start, StreamEntryID end, int count);
/**
* XREVRANGE key end start [COUNT <n>]
*
* @param key
* @param start minimum {@link StreamEntryID} for the retrieved range, passing <code>null</code> will indicate minimum ID possible in the stream
* @param end maximum {@link StreamEntryID} for the retrieved range, passing <code>null</code> will indicate maximum ID possible in the stream
* @param count The entries with IDs matching the specified range.
* @return the entries with IDs matching the specified range, from the higher ID to the lower ID matching.
*/
List<StreamEntry> xrevrange(String key, StreamEntryID end, StreamEntryID start, int count);
/**
* XACK key group ID [ID ...]
*
* @param key
* @param group
* @param ids
* @return
*/
long xack(String key, String group, StreamEntryID... ids);
/**
* XGROUP CREATE <key> <groupname> <id or $>
*
* @param key
* @param groupname
* @param id
* @param makeStream
* @return
*/
String xgroupCreate( String key, String groupname, StreamEntryID id, boolean makeStream);
/**
* XGROUP SETID <key> <groupname> <id or $>
*
* @param key
* @param groupname
* @param id
* @return
*/
String xgroupSetID( String key, String groupname, StreamEntryID id);
/**
* XGROUP DESTROY <key> <groupname>
*
* @param key
* @param groupname
* @return
*/
long xgroupDestroy( String key, String groupname);
/**
* XGROUP DELCONSUMER <key> <groupname> <consumername>
* @param key
* @param groupname
* @param consumername
* @return
*/
String xgroupDelConsumer( String key, String groupname, String consumername);
/**
* XPENDING key group [start end count] [consumer]
*
* @param key
* @param groupname
* @param start
* @param end
* @param count
* @param consumername
* @return
*/
List<StreamPendingEntry> xpending(String key, String groupname, StreamEntryID start, StreamEntryID end, int count, String consumername);
/**
* XDEL key ID [ID ...]
* @param key
* @param ids
* @return
*/
long xdel( String key, StreamEntryID... ids);
/**
* XTRIM key MAXLEN [~] count
* @param key
* @param maxLen
* @param approximate
* @return
*/
long xtrim( String key, long maxLen, boolean approximate);
/**
* XCLAIM <key> <group> <consumer> <min-idle-time> <ID-1> <ID-2>
* [IDLE <milliseconds>] [TIME <mstime>] [RETRYCOUNT <count>]
* [FORCE] [JUSTID]
*/
List<StreamEntry> xclaim( String key, String group, String consumername, long minIdleTime,
long newIdleTime, int retries, boolean force, StreamEntryID... ids);
}