更新时间:2023-12-27 GMT+08:00
分享

Redis命令参考

  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
String set(String key, String value);
String set(byte[] key, byte[] value);
String set(String key, String value, SetParams params);
String set(byte[] key, byte[] value, SetParams params);
String get(String key);
byte[] get(byte[] key);
Long del(String key);
Long del(byte[] key);
Boolean exists(String key);
Boolean exists(byte[] key);
Long persist(String key);
Long persist(byte[] key);
String type(String key);
String type(byte[] key);
byte[] dump(String key);
byte[] dump(byte[] key);
String restore(String key, Long ttl, byte[] serializedValue);
String restore(byte[] key, Long ttl, byte[] serializedValue);
Long expire(String key, Long seconds);
Long expire(byte[] key, Long seconds);
Long pexpire(String key, Long seconds);
Long pexpire(byte[] key, Long milliseconds);
Long expireAt(String key, Long unixTime);
Long expireAt(byte[] key, Long unixTime);
Long pexpireAt(String key, Long millisecondsTimestamp);
Long pexpireAt(byte[] key, Long millisecondsTimestamp);
Long ttl(String key);
Long ttl(byte[] key);
Long pttl(String key);
Long pttl(byte[] key);
Long touch(String key);
Long touch(byte[] key);
Boolean setbit(String key, Long offset, boolean value);
Boolean setbit(byte[] key, long offset, boolean value);
Boolean setbit(String key, Long offset, String value);
Boolean setbit(byte[] key, Long offset, byte[] value);
Boolean getbit(String key, Long offset);
Boolean getbit(byte[] key, long offset);
Long setrange(String key, Long offset, String value);
Long setrange(byte[] key, Long offset, byte[] value);
String getrange(String key, Long startOffset, Long endOffset);
byte[] getrange(byte[] key, long startOffset, long endOffset);
String getSet(String key, String value);
byte[] getSet(byte[] key, byte[] value);
Long setnx(String key, String value);
Long setnx(byte[] key, byte[] value);
String setex(String key, Long seconds, String value);
String setex(byte[] key, Long ttl, byte[] value);
String psetex(String key, Long milliseconds, String value);
String psetex(byte[] key, Long milliseconds, byte[] value);
Long decrBy(String key, Long decrement);
Long decrBy(byte[] key, Long decrement);
Long decr(String key);
Long decr(byte[] key);
Long incrBy(String key, Long increment);
Long incrBy(byte[] key, Long increment);
Double incrByFloat(String key, Double increment);
Double incrByFloat(byte[] key, Double increment);
Long incr(String key);
Long incr(byte[] key);
Long append(String key, String value);
Long append(byte[] key, byte[] value);
String substr(String key, Integer start, Integer end);
byte[] substr(byte[] key, Integer start, Integer end);
Long strlen(String key);
Long strlen(byte[] key);
Long del(String... key);
Long del(byte[]... key);
Set<String> keys(String expression);
Set<byte[]> keys(byte[] expression);
Long unlink(final String key);
Long unlink(final byte[] key);
Long unlink(final String... keys);
Long unlink(final byte[]... keys);
ScanResult<String> scan(String cursor, ScanParams params);
ScanResult<byte[]> scan(byte[] cursor, ScanParams params);
List<String> mget(String... keys);
List<byte[]> mget(byte[]... keys);
String mset(String... keysvalues);
Long msetnx(String... keysvalues);
String rename(String oldkey, String newkey);
String rename(byte[] oldkey, byte[] newkey);
Long renamenx(String oldkey, String newkey);
Long renamenx(byte[] oldkey, byte[] newkey);
String lindex(String key, Long index);
byte[] lindex(byte[] key, Long index);
Long linsert(String key, Boolean isBefore, String pivot, String value);
Long linsert(byte[] key, Boolean isBefore, byte[] pivot, byte[] value);
Long llen(String key);
Long llen(byte[] key);
String lpop(String key);
byte[] lpop(byte[] key);
Long lpush(String key, String... string);
Long lpush(byte[] key, byte[]... string);
Long lpushx(String key, String... string);
Long lpushx(byte[] key, byte[]... string);
List<String> lrange(String key, Long start, Long stop);
List<byte[]> lrange(byte[] key, Long start, Long stop);
Long lrem(String key, Long count, String value);
Long lrem(byte[] key, Long count, byte[] value);
String lset(String key, Long index, String value);
String lset(byte[] key, Long index, byte[] value);
String ltrim(String key, Long start, Long stop);
String ltrim(byte[] key, Long start, Long stop);
String rpop(String key);
byte[] rpop(byte[] key);
List<String> rpop(String key, int count);
List<byte[]> rpop(byte[] key, int count);
String rpoplpush(String srckey, String dstkey);
byte[] rpoplpush(byte[] srckey, byte[] dstkey);
Long rpush(String key, String... string);
Long rpush(byte[] key, byte[]... string);
Long rpushx(String key, String... string);
Long rpushx(byte[] key, byte[]... string);
Long hdel(String key, String... field);
Long hdel(byte[] key, byte[]... field);
Boolean hexists(String key, String field);
Boolean hexists(byte[] key, byte[] field);
String hget(String key, String field);
byte[] hget(byte[] key, byte[] field);
Map<String, String> hgetAll(String key);
Map<byte[], byte[]> hgetAll(byte[] key);
Long hincrBy(String key, String field, Long value);
Long hincrBy(byte[] key, byte[] field, Long value);
Double hincrByFloat(String key, String field, Double value);
Double hincrByFloat(byte[] key, byte[] field, Double value);
Set<String> hkeys(String key);
Set<byte[]> hkeys(byte[] key);
Long hlen(String key);
Long hlen(byte[] key);
List<String> hmget(String key, String... fields);
List<byte[]> hmget(byte[] key, byte[]... fields);
String hmset(String key, Map<String, String> hash);
String hmset(byte[] key, Map<byte[], byte[]> hash);
Long hset(String key, String field, String value);
Long hset(byte[] key, byte[] field, byte[] value);
Long hset(String key, Map<String, String> hash);
Long hset(byte[] key, Map<byte[], byte[]> hash);
Long hsetnx(String key, String field, String value);
Long hsetnx(byte[] key, byte[] field, byte[] value);
Long hstrlen(String key, String field);
Long hstrlen(byte[] key, byte[] field);
List<String> hvals(String key);
List<byte[]> hvals(byte[] key);
ScanResult<Map.Entry<String, String>> hscan(String key, String cursor);
ScanResult<Map.Entry<byte[], byte[]>> hscan(byte[] key, byte[] cursor);
ScanResult<Map.Entry<String, String>> hscan(final String key, final String cursor, final ScanParams params);
ScanResult<Map.Entry<byte[], byte[]>> hscan(final byte[] key, final byte[] cursor, final ScanParams params);
Long sadd(final String key, final String... member);
Long sadd(final byte[] key, final byte[]... member);
Long scard(final String key);
Long scard(final byte[] key);
Set<String> sdiff(final String... keys);
Set<byte[]> sdiff(final byte[]... keys);
Long sdiffstore(final String dstkey, final String... keys);
Set<String> sinter(final String... keys);
Set<byte[]> sinter(final byte[]... keys);
Long sinterstore(final String dstkey, final String... keys);
Boolean sismember(final String key, final String member);
Boolean sismember(final byte[] key, final byte[] member);
Set<String> smembers(final String key);
Set<byte[]> smembers(final byte[] key);
Long smove(final String srckey, final String dstkey, final String member);
Long smove(final byte[] srckey, final byte[] dstkey, final byte[] member);
String spop(final String key);
byte[] spop(final byte[] key);
Set<String> spop(final String key, final Long count);
Set<byte[]> spop(final byte[] key, final Long count);
String srandmember(final String key);
byte[] srandmember(final byte[] key);
List<String> srandmember(final String key, final Integer count);
List<byte[]> srandmember(final byte[] key, final Integer count);
Long srem(final String key, final String... member);
Long srem(final byte[] key, final byte[]... member);
Set<String> sunion(final String... keys);
Set<byte[]> sunion(final byte[]... keys);
Long sunionstore(final String dstkey, final String... keys);
Long sunionstore(final byte[] dstkey, final byte[]... keys);
ScanResult<String> sscan(final String key, final String cursor);
ScanResult<byte[]> sscan(final byte[] key, final byte[] cursor);
Long zadd(String key, Double score, String member);
Long zadd(byte[] key, Double score, byte[] member);
Long zadd(String key, Double score, String member, ZAddParams params);
Long zadd(byte[] key, Double score, byte[] member, ZAddParams params);
Long zadd(String key, Map<String, Double> scoreMembers);
Long zadd(byte[] key, Map<byte[], Double> scoreMembers);
Long zadd(String key, Map<String, Double> scoreMembers, ZAddParams params);
Long zadd(byte[] key, Map<byte[], Double> scoreMembers, ZAddParams params);
Set<String> zrange(String key, Long start, Long stop);
Set<byte[]> zrange(byte[] key, Long start, Long stop);
Long zrem(String key, String... members);
Long zrem(byte[] key, byte[]... members);
Double zincrby(String key, Double increment, String member);
Double zincrby(byte[] key, Double increment, byte[] member);
Double zincrby(String key, Double increment, String member, ZIncrByParams params);
Double zincrby(byte[] key, Double increment, byte[] member, ZIncrByParams params);
Long zrank(String key, String member);
Long zrank(byte[] key, byte[] member);
Long zrevrank(String key, String member);
Long zrevrank(byte[] key, byte[] member);
Set<String> zrevrange(String key, Long start, Long stop);
Set<byte[]> zrevrange(byte[] key, Long start, Long stop);
Set<Tuple> zrangeWithScores(String key, Long start, Long stop);
Set<Tuple> zrangeWithScores(byte[] key, Long start, Long stop);
Set<Tuple> zrevrangeWithScores(String key, Long start, Long stop);
Set<Tuple> zrevrangeWithScores(byte[] key, Long start, Long stop);
Long zcard(String key);
Long zcard(byte[] key);
Double zscore(String key, String member);
Double zscore(byte[] key, byte[] member);
Tuple zpopmax(String key);
Tuple zpopmax(byte[] key);
Set<Tuple> zpopmax(String key, Integer count);
Set<Tuple> zpopmax(byte[] key, Integer count);
Tuple zpopmin(String key);
Tuple zpopmin(byte[] key);
Set<Tuple> zpopmin(String key, Integer count);
Set<Tuple> zpopmin(byte[] key, Integer count);
List<String> sort(String key);
List<byte[]> sort(byte[] key);
List<String> sort(String key, SortingParams sortingParameters);
List<byte[]> sort(byte[] key, SortingParams sortingParameters);
Long zcount(String key, Double min, Double max);
Long zcount(byte[] key, Double min, Double max);
Long zcount(String key, String min, String max);
Long zcount(byte[] key, byte[] min, byte[] max);
Set<String> zrangeByScore(String key, Double min, Double max);
Set<byte[]> zrangeByScore(byte[] key, Double min, Double max);
Set<String> zrangeByScore(String key, String min, String max);
Set<byte[]> zrangeByScore(byte[] key, byte[] min, byte[] max);
Set<String> zrevrangeByScore(String key, Double max, Double min);
Set<byte[]> zrevrangeByScore(byte[] key, Double max, Double min);
Set<String> zrangeByScore(String key, Double min, Double max, Integer offset, Integer count);
Set<byte[]> zrangeByScore(byte[] key, Double min, Double max, Integer offset, Integer count);
Set<String> zrevrangeByScore(String key, String max, String min);
Set<byte[]> zrevrangeByScore(byte[] key, byte[] max, byte[] min);
Set<String> zrangeByScore(String key, String min, String max, Integer offset, Integer count);
Set<byte[]> zrangeByScore(byte[] key, byte[] min, byte[] max, Integer offset, Integer count);
Set<String> zrevrangeByScore(String key, Double max, Double min, Integer offset, Integer count);
Set<byte[]> zrevrangeByScore(byte[] key, Double max, Double min, Integer offset, Integer count);
Set<Tuple> zrangeByScoreWithScores(String key, Double min, Double max);
Set<Tuple> zrangeByScoreWithScores(byte[] key, Double min, Double max);
Set<Tuple> zrevrangeByScoreWithScores(String key, Double max, Double min);
Set<Tuple> zrevrangeByScoreWithScores(byte[] key, Double max, Double min);
Set<Tuple> zrangeByScoreWithScores(String key, Double min, Double max, Integer offset, Integer count);
Set<Tuple> zrangeByScoreWithScores(byte[] key, Double min, Double max, Integer offset, Integer count);
Set<String> zrevrangeByScore(String key, String max, String min, Integer offset, Integer count);
Set<byte[]> zrevrangeByScore(byte[] key, byte[] max, byte[] min, Integer offset, Integer count);
Set<Tuple> zrangeByScoreWithScores(String key, String min, String max);
Set<Tuple> zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max);
Set<Tuple> zrevrangeByScoreWithScores(String key, String max, String min);
Set<Tuple> zrevrangeByScoreWithScores(byte[] key, byte[] max, byte[] min);
Set<Tuple> zrangeByScoreWithScores(String key, String min, String max, Integer offset, Integer count);
Set<Tuple> zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max, Integer offset, Integer count);
Set<Tuple> zrevrangeByScoreWithScores(String key, Double max, Double min, Integer offset, Integer count);
Set<Tuple> zrevrangeByScoreWithScores(byte[] key, Double max, Double min, Integer offset, Integer count);
Set<Tuple> zrevrangeByScoreWithScores(String key, String max, String min, Integer offset, Integer count);
Set<Tuple> zrevrangeByScoreWithScores(byte[] key, byte[] max, byte[] min, Integer offset, Integer count);
Long zremrangeByRank(String key, Long start, Long stop);
Long zremrangeByRank(byte[] key, Long start, Long stop);
Long zremrangeByScore(String key, Double min, Double max);
Long zremrangeByScore(byte[] key, Double min, Double max);
Long zremrangeByScore(String key, String min, String max);
Long zremrangeByScore(byte[] key, byte[] min, byte[] max);
Long zinterstore(String dstkey, String... sets);
Long zinterstore(byte[] dstkey, byte[]... sets);
Long zlexcount(String key, String min, String max);
Long zlexcount(byte[] key, byte[] min, byte[] max);
Set<String> zrangeByLex(String key, String min, String max);
Set<byte[]> zrangeByLex(byte[] key, byte[] min, byte[] max);
Set<String> zrangeByLex(String key, String min, String max, Integer offset, Integer count);
Set<byte[]> zrangeByLex(byte[] key, byte[] min, byte[] max, Integer offset, Integer count);
Set<String> zrevrangeByLex(String key, String max, String min);
Set<byte[]> zrevrangeByLex(byte[] key, byte[] max, byte[] min);
Set<String> zrevrangeByLex(String key, String max, String min, Integer offset, Integer count);
Set<byte[]> zrevrangeByLex(byte[] key, byte[] max, byte[] min, Integer offset, Integer count);
Long zremrangeByLex(String key, String min, String max);
Long zremrangeByLex(byte[] key, byte[] min, byte[] max);
Object eval(String script, Integer keyCount, String... params);
Object eval(byte[] script, Integer keyCount, byte[]... params);
Object eval(String script, List<String> keys, List<String> args);
Object eval(byte[] script, List<byte[]> keys, List<byte[]> args);
Object eval(String script, String sampleKey);
Object eval(byte[] script, byte[] sampleKey);
Object evalsha(String sha1, String sampleKey);
Object evalsha(byte[] sha1, byte[] sampleKey);
Object evalsha(String sha1, List<String> keys, List<String> args);
Object evalsha(byte[] sha1, List<byte[]> keys, List<byte[]> args);
Object evalsha(String sha1, Integer keyCount, String... params);
Object evalsha(byte[] sha1, Integer keyCount, byte[]... params);
Boolean scriptExists(String sha1, String sampleKey);
List<Boolean> scriptExists(String sampleKey, String... sha1);
String scriptLoad(String script, String sampleKey);
String scriptFlush(String sampleKey);
String scriptKill(String sampleKey);
List<Long> scriptExists(byte[]... sha1);
byte[] scriptLoad(byte[] script);
String scriptFlush();
String scriptFlush(FlushMode flushMode);
String scriptKill();
Boolean scriptExists(String sha1);
List<Boolean> scriptExists(String... sha1);
String scriptLoad(String script);
List<Long> scriptExists(byte[] sampleKey, byte[]... sha1);
byte[] scriptLoad(byte[] script, byte[] sampleKey);
String scriptFlush(byte[] sampleKey);
String scriptFlush(byte[] sampleKey, FlushMode flushMode);
String scriptKill(byte[] sampleKey);
List<String> blpop(Integer timeout, String key);
List<byte[]> blpop(Integer timeout, byte[] key);
List<String> blpop(Integer timeout, String... keys);
List<byte[]> blpop(Integer timeout, byte[]... keys);
List<String> brpop(Integer timeout, String key);
List<byte[]> brpop(Integer timeout, byte[] key);
List<String> brpop(Integer timeout, String... keys);
List<byte[]> brpop(Integer timeout, byte[]... keys);
String brpoplpush(String source, String destination, Integer timeout);
byte[] brpoplpush(byte[] source, byte[] destination, Integer timeout);
String watch(String... keys);
String watch(byte[]... keys);
String unwatch();
KeyedZSetElement bzpopmax(Double timeout, String... keys);
KeyedZSetElement bzpopmin(Double timeout, String... keys);
ScanResult<Tuple> zscan(String key, String cursor);
ScanResult<Tuple> zscan(byte[] key, byte[] cursor);
ScanResult<Tuple> zscan(final String key, final String cursor, final ScanParams params);
ScanResult<Tuple> zscan(final byte[] key, final byte[] cursor, final ScanParams params);
Long geoadd(String key, Double longitude, Double latitude, String member);
Long geoadd(byte[] key, Double longitude, Double latitude, byte[] member);
Long geoadd(String key, Map<String, GeoCoordinate> memberCoordinateMap);
Long geoadd(byte[] key, Map<byte[], GeoCoordinate> memberCoordinateMap);
List<GeoRadiusResponse> georadius(String key, Double longitude, Double latitude, Double radius, GeoUnit unit);
List<GeoRadiusResponse> georadius(byte[] key, Double longitude, Double latitude, Double radius, GeoUnit unit);
List<GeoCoordinate> geopos(String key, String... members);
List<GeoCoordinate> geopos(byte[] key, byte[]... members);
Double geodist(String key, String member1, String member2);
Double geodist(byte[] key, byte[] member1, byte[] member2);
Double geodist(String key, String member1, String member2, GeoUnit unit);
Double geodist(byte[] key, byte[] member1, byte[] member2, GeoUnit unit);
List<String> geohash(String key, String... members);
List<byte[]> geohash(byte[] key, byte[]... members);
Long publish(String channel, String message);
Long publish(byte[] channel, byte[] message);
Long pubsubNumPat();
List<String> pubsubChannels(String pattern);
List<String> pubsubChannels();
Map<String, String> pubsubNumSub(String... channels);
String psubscribe(JedisPubSub jedisPubSub, String... patterns);
String subscribe(JedisPubSub jedisPubSub, String... channels);
String psubscribe(BinaryJedisPubSub jedisPubSub, byte[]... patterns);
String subscribe(BinaryJedisPubSub jedisPubSub, byte[]... channels);
String ping();
String info();
String info(final String section);
String clusterInfo();
  • pipeline功能使用
    • 需要返回值示例:
      @Autowired
      private MultiZoneClient client;
      public void Demo() {
          client.executePipeline(pipeline -> {
              pipeline.set("devspore", "test");
              pipeline.setnx("aaa", "bbb");
              return pipeline.syncAndReturn();
          });
      }
    • 不需要返回值示例:
      @Autowired
      private MultiZoneClient client;
      public void Demo() {
          client.executePipeline(pipeline -> {
              pipeline.set("devspore", "test");
              pipeline.setnx("aaa", "bbb");
              return null;
          });
      }
  • DcsConnection 已实现部分RedisConnection的接口:用户有需要时可以继承重写此类方法
public Long append(@Nonnull byte[] key, @Nonnull byte[] value);
public Boolean expire(@Nonnull byte[] key, long seconds);
public Boolean pExpire(@Nonnull byte[] key, long millis);
public byte[] get(@Nonnull byte[] key);
public byte[] getSet(@Nonnull byte[] key, @Nonnull byte[] value);
public Boolean set(@Nonnull byte[] key, @Nonnull byte[] value);
public Boolean setEx(@Nonnull byte[] key, long seconds, @Nonnull byte[] value);
public Boolean setNX(@Nonnull byte[] key, @Nonnull byte[] value);
public Boolean set(@Nonnull byte[] key, @Nonnull byte[] value, @Nonnull Expiration expiration, @Nonnull SetOption option);
public void setRange(@Nonnull byte[] key, @Nonnull byte[] value, long offset);
public Long exists(@Nonnull byte[]... keys);
public Long del(@Nonnull byte[]... keys);
public Long unlink(@Nonnull byte[]... keys);
public Set<byte[]> keys(@Nonnull byte[] pattern);
public Cursor<byte[]> scan(@Nonnull ScanOptions options);
public DataType type(@Nonnull byte[] key);
public Set<byte[]> sMembers(@Nonnull byte[] key);
public Long sAdd(@Nonnull byte[] key, @Nonnull byte[]... values);
public Long sRem(@Nonnull byte[] key, @Nonnull byte[]... values);
public Boolean sIsMember(@Nonnull byte[] key, @Nonnull byte[] value);
public Boolean zAdd(@Nonnull byte[] key, double score, @Nonnull byte[] value);
public Long zAdd(@Nonnull byte[] key, @Nonnull Set<Tuple> tuples) ;
public Long zAdd(@Nonnull byte[] key, @Nonnull Set<Tuple> set, @Nonnull ZAddArgs zAddArgs);
public Boolean zAdd(@Nonnull byte[] key, double v, @Nonnull byte[] member, @Nonnull ZAddArgs zAddArgs);
public Long zRem(@Nonnull byte[] key, @Nonnull byte[]... values);
public Double zIncrBy(@Nonnull byte[] key, double increment, @Nonnull byte[] value);
public Long zCard(@Nonnull byte[] key);
public Double zScore(@Nonnull byte[] key, @Nonnull byte[] value);
public Long zRemRange(@Nonnull byte[] key, long start, long end);
public Long zRemRangeByLex(@Nonnull byte[] key, @Nonnull Range range);
public Set<byte[]> zRange(@Nonnull byte[] key, long start, long end);
public Set<byte[]> zRevRange(@Nonnull byte[] key, long start, long end);
public Cursor<Tuple> zScan(@Nonnull byte[] key, @Nonnull ScanOptions options);
public Set<byte[]> zRangeByScore(@Nonnull byte[] key, @Nonnull Range range, @Nonnull Limit limit);
public Set<byte[]> zRangeByScore(@Nonnull byte[] key, @Nonnull String min, @Nonnull String max, long offset, long count);
public Long zRemRangeByScore(@Nonnull byte[] key, Range range);
public byte[] hGet(@Nonnull byte[] key, @Nonnull byte[] field);
public Map<byte[], byte[]> hGetAll(@Nonnull byte[] key);
public Boolean hSet(@Nonnull byte[] key, @Nonnull byte[] field, @Nonnull byte[] value);
public Cursor<Map.Entry<byte[], byte[]>> hScan(@Nonnull byte[] key, @Nonnull ScanOptions options);
public void hMSet(@Nonnull byte[] key, @Nonnull Map<byte[], byte[]> hashes);
public Long hDel(@Nonnull byte[] key, @Nonnull byte[]... fields);
public Boolean hExists(@Nonnull byte[] key, @Nonnull byte[] field);
public Set<byte[]> hKeys(@Nonnull byte[] key);
public List<byte[]> hVals(byte[] key);
public Long hIncrBy(@Nonnull byte[] key, @Nonnull byte[] field, long delta);
public Double hIncrBy(@Nonnull byte[] key, @Nonnull byte[] field, double delta);
public List<byte[]> lRange(@Nonnull byte[] key, long start, long end);
public Long rPush(@Nonnull byte[] key, @Nonnull byte[]... values);
public Long lInsert(@Nonnull byte[] key, @Nonnull Position where, @Nonnull byte[] pivot, @Nonnull byte[] value);
public void lSet(@Nonnull byte[] key, long index, @Nonnull byte[] value);
public Long lPush(@Nonnull byte[] key, @Nonnull byte[]... values);
public Long lLen(@Nonnull byte[] key);
public byte[] lPop(@Nonnull byte[] key);
public List<byte[]> bLPop(int timeout, @Nonnull byte[]... keys);
public byte[] rPop(@Nonnull byte[] bytes);
public List<byte[]> bRPop(int i, @Nonnull byte[]... bytes);
public Long incr(@Nonnull byte[] key);
public Long incrBy(@Nonnull byte[] key, long value);
public Double incrBy(@Nonnull byte[] key, double value);
public Long decr(@Nonnull byte[] key);
public Long decrBy(@Nonnull byte[] key, long value);
public Long ttl(@Nonnull byte[] key);
public Long ttl(@Nonnull byte[] key, @Nonnull TimeUnit timeUnit);
public Long pTtl(@Nonnull byte[] key);
public Long pTtl(@Nonnull byte[] key, @Nonnull TimeUnit timeUnit);
public MultiZoneClient getNativeConnection();
public boolean isSubscribed();
public Subscription getSubscription();
public void subscribe(MessageListener listener, byte[]... channels);
public Long publish(byte[] channel, byte[] message);
public void pSubscribe(MessageListener listener, byte[]... patterns);
public <T> T eval(byte[] script, ReturnType returnType, int numKeys, byte[]... keysAndArgs);
public <T> T evalSha(byte[] scriptSha, ReturnType returnType, int numKeys, byte[]... keysAndArgs);
public <T> T evalSha(String scriptSha, ReturnType returnType, int numKeys, byte[]... keysAndArgs);
public void lTrim(byte[] key, long start, long end);
public Long lRem(byte[] key, long count, byte[] value);
public Properties info();
public Properties info(String section);
public String ping();
  • RedisTemplate命令对应DcsConnection接口
表1 redisTemplate和DcsConnection对应关系

RedisTemplate命令

DcsConnection方法

expire(stringKey, 1L, TimeUnit.SECONDS)

expire(stringKey, Duration.ofSeconds(10L))

Boolean pExpire(@Nonnull byte[] key, long millis)

opsForValue().get(stringKey)

byte[] get(@Nonnull byte[] key)

opsForValue().set(stringKey, stringValue)

Boolean set(@Nonnull byte[] key, @Nonnull byte[] value)

opsForValue().set(stringKey, stringValue, 1L, TimeUnit.SECONDS)

// Boolean setEx(@Nonnull byte[] key, long seconds, @Nonnull byte[] value)

opsForValue().setIfAbsent(stringKey, stringValue)

Boolean setNX(@Nonnull byte[] key, @Nonnull byte[] value)

opsForValue().setIfAbsent(stringKey, stringValue, 1L, TimeUnit.SECONDS)

Boolean set(@Nonnull byte[] key, @Nonnull byte[] value, @Nonnull Expiration expiration, @Nonnull RedisStringCommands.SetOption option)

opsForValue().set(stringKey, stringValue, 1L)

void setRange(@Nonnull byte[] key, @Nonnull byte[] value, long offset)

opsForValue().append(stringKey, stringValue)

public Long append(@Nonnull byte[] key, @Nonnull byte[] value)

opsForValue().decrement("numKey")

Long decr(@Nonnull byte[] key)

opsForValue().decrement("numKey", 2)

Long decrBy(@Nonnull byte[] key, long value)

countExistingKeys(Collections.singleton("devspore"))

Long exists(@Nonnull byte[]... keys)

delete(stringKey)

Long del(@Nonnull byte[]... keys)

opsForValue().increment(stringKey)

Long incr(@Nonnull byte[] key)

opsForValue().increment(stringKey, 1L)

Long incrBy(@Nonnull byte[] key, long value)

opsForValue().increment(stringKey, 1D)

Double incrBy(@Nonnull byte[] key, double value)

opsForValue().getAndSet("appendKey", "getSetValue")

byte[] getSet(@Nonnull byte[] key, @Nonnull byte[] value)

keys(stringKey)

Set<byte[]> keys(@Nonnull byte[] pattern)

opsForSet().members(setKey)

Set<byte[]> sMembers(@Nonnull byte[] key)

opsForSet().add(setKey, setValue)

Long sAdd(@Nonnull byte[] key, @Nonnull byte[]... values)

opsForSet().remove(setKey,setValue)

Long sRem(@Nonnull byte[] key, @Nonnull byte[]... values)

opsForSet().isMember(setKey, setValue)

Boolean sIsMember(@Nonnull byte[] key, @Nonnull byte[] value)

opsForZSet().add(zSetKey, zSetValue, 1)

Boolean zAdd(@Nonnull byte[] key, double score, @Nonnull byte[] value)

opsForZSet().add(zSetKey, Collections.singleton(new DefaultTypedTuple<>(zSetValue, 1d)))

Long zAdd(@Nonnull byte[] key, @Nonnull Set<Tuple> tuples)

opsForZSet().addIfAbsent(zSetKey, Collections.singleton(new DefaultTypedTuple<>(zSetValue, 1d)))

Long zAdd(@Nonnull byte[] key, @Nonnull Set<Tuple> set, @Nonnull ZAddArgs zAddArgs)

opsForZSet().addIfAbsent(zSetKey, zSetValue, 1)

Boolean zAdd(@Nonnull byte[] key, double v, @Nonnull byte[] member, @Nonnull ZAddArgs zAddArgs)

opsForZSet().zCard(zSetKey)

Long zCard(@Nonnull byte[] key)

opsForZSet().rangeByScore(zSetKey, 1D, 2D)

Set<byte[]> zRangeByScore(@Nonnull byte[] key, @Nonnull Range range, @Nonnull Limit limit)

opsForZSet().rangeByScore(zSetKey, 1D, 2D, 1L, 1L)

Set<byte[]> zRangeByScore(@Nonnull byte[] key, @Nonnull Range range, @Nonnull Limit limit)

opsForZSet().remove(zSetKey, zSetThirdValue)

Long zRem(@Nonnull byte[] key, @Nonnull byte[]... values)

opsForZSet().incrementScore(zSetKey, zSetValue, 2)

Double zIncrBy(@Nonnull byte[] key, double increment, @Nonnull byte[] value)

opsForZSet().score(zSetKey, zSetValue)

Double zScore(@Nonnull byte[] key, @Nonnull byte[] value)

opsForZSet().removeRange(zSetKey, 0, 2)

Long zRemRange(@Nonnull byte[] key, long start, long end)

opsForZSet().range(zSetKey, 0, 4)

Set<byte[]> zRange(@Nonnull byte[] key, long start, long end)

opsForZSet().reverseRange(zSetKey, 0, 2)

Set<byte[]> zRevRange(@Nonnull byte[] key, long start, long end)

opsForZSet().removeRangeByScore(zSetKey, 1, 2)

Long zRemRangeByScore(@Nonnull byte[] key, Range range)

Long zRemRangeByLex(@Nonnull byte[] key, @Nonnull Range range)

opsForZSet().removeRangeByLex(zSetKey, new RedisZSetCommands.Range().gte(zSetValue).lte(zSetSecondValue))

opsForHash().get(hKey, hValue)

byte[] hGet(@Nonnull byte[] key, @Nonnull byte[] field)

opsForHash().entries(hKey)

Map<byte[], byte[]> hGetAll(@Nonnull byte[] key)

opsForHash().put(hKey, "filed", hValue)

Boolean hSet(@Nonnull byte[] key, @Nonnull byte[] field, @Nonnull byte[] value)

opsForHash().putAll(hKey, hashes)

hMSet(@Nonnull byte[] key, @Nonnull Map<byte[], byte[]> hashes)

opsForHash().delete(hKey, "field")

Long hDel(@Nonnull byte[] key, @Nonnull byte[]... fields)

opsForHash().hasKey(hKey, "field")

Boolean hExists(@Nonnull byte[] key, @Nonnull byte[] field)

opsForHash().keys(hKey)

Set<byte[]> hKeys(@Nonnull byte[] key)

opsForHash().increment(hKey, "field", 1L)

Long hIncrBy(@Nonnull byte[] key, @Nonnull byte[] field, long delta)

opsForHash().increment(hKey, "field", 2D)

Double hIncrBy(@Nonnull byte[] key, @Nonnull byte[] field, double delta)

opsForHash().scan(hKey, ScanOptions.scanOptions().build())

Cursor<Map.Entry<byte[], byte[]>> hScan(@Nonnull byte[] key, @Nonnull ScanOptions options)

opsForHash().values(hKey)

List<byte[]> hVals(byte[] key)

opsForList().set(lKey, 0, "setValue")

void lSet(@Nonnull byte[] key, long index, @Nonnull byte[] value)

opsForList().range(lKey, 1, 2)

List<byte[]> lRange(@Nonnull byte[] key, long start, long end)

opsForList().rightPush(lKey, lValue)

Long rPush(@Nonnull byte[] key, @Nonnull byte[]... values)

opsForList().leftPush(lKey, lValue)

Long lPush(@Nonnull byte[] key, @Nonnull byte[]... values)

opsForList().leftPop(lKey)

byte[] lPop(@Nonnull byte[] key)

opsForList().leftPop(lKey, 1L, TimeUnit.SECONDS)

List<byte[]> bLPop(int timeout, @Nonnull byte[]... keys)

opsForList().rightPop(lKey)

byte[] rPop(@Nonnull byte[] bytes)

opsForList().trim(lKey, 0, 2);

void lTrim(byte[] key, long start, long end)

opsForList().remove(lKey, 1, str2byte("setValue"))

Long lRem(byte[] key, long count, byte[] value)

opsForList().size(lKey)

Long lLen(@Nonnull byte[] key)

getExpire(lKey, TimeUnit.SECONDS)

Long pTtl(@Nonnull byte[] key)Long pTtl(@Nonnull byte[] key, @Nonnull TimeUnit timeUnit)

unlink(str2byte("unlinkKey")))

Long unlink(@Nonnull byte[]... keys)

type(stringKey)

DataType type(@Nonnull byte[] key)

分享:

    相关文档

    相关产品