更新时间:2024-10-23 GMT+08:00
Redis命令参考
MultiZoneClient集成了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(); |
父主题: 命令参考