原文网址:Redisson--SpringBoot--整合/使用/用法/实例/示例/实战/教程/官网--Redis客户端_IT利刃出鞘的博客-CSDN博客
简介说明
Redis的客户端有RedisTemplate、Jedis、Redisson等。Redisson是最好的客户端,原因如下:
- 简单好用。
- 它实现了JDK里的List、Set、Map等接口,可以用操作JDK的类的方式操作Redis。
- 分布式锁很完美。
- 它在锁的续期、可重入、释放等处理的很好。详见:Redisson原理--Redis分布式锁--方案/机制--续期/释放/互斥/可重入_IT利刃出鞘的博客-CSDN博客
官网
git文档:https://github.com/redisson/redisson/wiki
git:https://github.com/redisson/redisson
官网:https://redisson.org/
Redisson功能
- 支持同步/异步/异步流/管道流方式连接
- 多样化数据序列化
- 集合数据分片
- 分布式对象
- 分布式集合
- 分布式锁和同步器
- 分布式服务
- 独立节点模式
- 三方框架整合
org.redisson redisson-spring-boot-starter3.16.1
当然,只引用Redisson也可以。(但这样配置繁琐,本文不使用此法)
配置org.redisson redisson3.8.2
官网
2. 配置方法 · redisson/redisson Wiki · GitHub(官网wiki的配置文档)
简介
以下方法的推荐度由高到低。
对于配置文件方案,引入的依赖必须是redisson-spring-boot-starter;对于配置类配置方案,引入的依赖可以是redisson-spring-boot-starter也可以是redisson。
法1:application.yml
spring:
redis:
host:
port:
database:
password:
cluster:
nodes:
sentinel:
master:
nodes:
ssl:
timeout:
上边这个redis的通用配置基本够用了。可对Redisson进行更加详细的配置:哨兵、集群等
spring:
redis:
host:
port:
database:
password:
cluster:
nodes:
sentinel:
master:
nodes:
ssl:
timeout:
redisson:
clusterServersConfig:
idleConnectionTimeout: 10000
connectTimeout: 10000
timeout: 3000
retryAttempts: 3
retryInterval: 1500
password: null
subscriptionsPerConnection: 5
clientName: null
loadBalancer: ! {}
slaveSubscriptionConnectionMinimumIdleSize: 1
slaveSubscriptionConnectionPoolSize: 50
slaveConnectionMinimumIdleSize: 32
slaveConnectionPoolSize: 64
masterConnectionMinimumIdleSize: 32
masterConnectionPoolSize: 64
readMode: "SLAVE"
nodeAddresses:
- "redis://127.0.0.1:7004"
- "redis://127.0.0.1:7001"
- "redis://127.0.0.1:7000"
scanInterval: 1000
threads: 0
nettyThreads: 0
codec: ! {}
"transportMode":"NIO"
法2:将redisson配置单独拿出来
需要在Resource目录下创建redisson.yml。
redisson配置文件优先级高于springboot配置文件优先级;
application.yml
spring:
redis:
host:
port:
database:
password:
cluster:
nodes:
sentinel:
master:
nodes:
ssl:
timeout:
redisson:
config: classpath:redisson.yml
redisson.yml
clusterServersConfig: idleConnectionTimeout: 10000 connectTimeout: 10000 timeout: 3000 retryAttempts: 3 retryInterval: 1500 password: null subscriptionsPerConnection: 5 clientName: null loadBalancer: !{} slaveSubscriptionConnectionMinimumIdleSize: 1 slaveSubscriptionConnectionPoolSize: 50 slaveConnectionMinimumIdleSize: 32 slaveConnectionPoolSize: 64 masterConnectionMinimumIdleSize: 32 masterConnectionPoolSize: 64 readMode: "SLAVE" nodeAddresses: - "redis://127.0.0.1:7004" - "redis://127.0.0.1:7001" - "redis://127.0.0.1:7000" scanInterval: 1000 threads: 0 nettyThreads: 0 codec: ! {} "transportMode":"NIO"
法3:编写配置类(不推荐)
需要在Resource目录下创建redisson.yml。
@Configuration
public class RedssonConfig {
@Bean(destroyMethod="shutdown")
public RedissonClient redisson() throws IOException {
RedissonClient redisson = Redisson.create(
Config.fromYAML(new ClassPathResource("redisson-single.yml").getInputStream()));
return redisson;
}
}
上边这种方法已经违背配置大于编程了。
法4:用代码配置(不推荐)
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class RedissonConfig {
@Bean
public RedissonClient redissonClient() {
//指定编码,默认编码为org.redisson.codec.JsonJacksonCodec
//config.setCodec(new org.redisson.client.codec.StringCodec());
config.useSingleServer().setAddress("redis://127.0.0.1:6379");
config.useSingleServer().setClientName("root");
config.useSingleServer().setPassword("abcabc");
return Redisson.create(config);
}
}
实例
其他网址
2-(1)、SpringBoot整合redisson实现分布式锁 - 简书
(Redis使用系列) Springboot 整合Redisson 实现分布式锁 七-CSDN博客
SpringBoot集成redisson分布式锁 - 自行车上的程序员 - 博客园
代码
package com.xiaoliu.redission.lock;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class ShopCartController {
@Autowired
private StringRedisTemplate stringRedisTemplate;
@Autowired
private RedissonClient redissonClient;
private static final String product="MoonCake";
@GetMapping("/submitOrder")
public String submitOrder(){
RLock lock = redissonClient.getLock(product);
try {
lock.lock();//阻塞
// boolean b = lock.tryLock();//非阻塞
int stock = Integer.parseInt(stringRedisTemplate.opsForValue().get("stock"));
if (stock>0){
//下单
stock-=1;
stringRedisTemplate.opsForValue().set("stock", String.valueOf(stock));
System.out.println("扣减成功,库存stock:"+stock);
}else {
//没库存
System.out.println("扣减失败,库存不足");
}
} finally {
lock.unlock();//释放锁
}
return "end";
}
}
常用操作
获得Redisson客户端
@Autowired private RedissonClient redissonClient;
根据key获得value
所有get开头的方法:如果key不存在会在保存时以此key为key保存。
| 方法 | 返回类型 |
| getSet("xxx") | RSet |
| getList("xxx") | RList |
| getMap("anyMap"); | RMap |
| getSetMultimap("myMultimap"); | RSetMultimap |
| getSortedSet("anySet"); | RSortedSet |
| getScoredSortedSet("simple"); | RScoredSortedSet |
| getLexSortedSet("simple"); | RLexSortedSet set |
| getQueue("anyQueue"); | RQueue |
| getDeque("anyDeque"); | RDeque |
| getBlockingQueue("anyQueue"); | BlockingQueue |
| getBoundedBlockingQueue("anyQueue"); | RBoundedBlockingQueue |
| getBlockingDeque("anyDeque"); | RBlockingDeque |
| getBlockingFairQueue("myQueue"); | RBlockingFairQueue |
| getBlockingFairDeque("myDeque"); | RBlockingFairDeque |
| getDelayedQueue(distinationQueue); | RDelayedQueue |
| getPriorityQueue("anyQueue"); | RPriorityQueue |
| getPriorityDeque("anyQueue"); | RPriorityDeque |
| getPriorityBlockingQueue("anyQueue"); | RPriorityBlockingQueue |
| RPriorityBlockingDeque | getPriorityBlockingDeque("anyQueue"); |
将key-value写回Redis
所有添加都会自动将值写回Redis。例如:
RSet所有方法 过期时间set = redisson.getSet("anySet"); set.add("Tony");
所有的类型都有过期时间,例如:
RSetset = redisson.getSet("anySet"); set.add("Tony"); set.expire(3, TimeUnit.MINUTES);
过期时间在类型为空时是无效的,例如:
RSetset = redisson.getSet("anySet"); set.expire(3, TimeUnit.MINUTES); set.add("Tony");
也可以给某一个值设置过期时间
RSetCacheRedis命令与Redisson方法对应set = redisson.getSetCache("anySet"); // ttl = 10 seconds set.add("abc", 10, TimeUnit.SECONDS);
| Redis command | Sync / Async Api Redisson.create(config) | Reactive Api Redisson.createReactive(config) | RxJava2 Api Redisson.createRx(config) |
|---|---|---|---|
| AUTH | Config.setPassword() | - | - |
| APPEND | RBinaryStream. getOutputStream().write() | - | - |
| BZPOPMAX | RScoredSortedSet. pollLast() pollLastAsync() | RScoredSortedSetReactive. pollLast() | RScoredSortedSetRx. pollLast() |
| BZPOPMIN | RScoredSortedSet. pollFirst() pollFirstAsync() | RScoredSortedSetReactive. pollFirst() | RScoredSortedSetRx. pollFirst() |
| BITCOUNT | RBitSet. cardinality() cardinalityAsync() | RBitSetReactive. cardinality() | RBitSetRx. cardinality() |
| BITOP | RBitSet. or() and() xor() orAsync() andAsync() xorAsync() | RBitSetReactive. or() and() xor() | RBitSetRx. or() and() xor() |
| BITPOS | RBitSet. length() lengthAsync() | RBitSetReactive. length() | RBitSetRx. length() |
| BLPOP | RBlockingQueue. take() poll() pollFromAny() takeAsync() pollAsync() pollFromAnyAsync() | RBlockingQueueReactive. take() poll() pollFromAny() | RBlockingQueueRx. take() poll() pollFromAny() |
| BRPOP | RBlockingDeque. takeLast() takeLastAsync() | RBlockingDequeReactive. takeLast() | RBlockingDequeRx. takeLast() |
| BRPOPLPUSH | RBlockingQueue. pollLastAndOfferFirstTo() pollLastAndOfferFirstToAsync() | RBlockingQueueReactive. pollLastAndOfferFirstTo() | RBlockingQueueRx. pollLastAndOfferFirstTo() |
| ConFIG GET | RedisNode. setConfig() setConfigAsync() | - | - |
| ConFIG SET | RedisNode. getConfig() getConfigAsync() | - | - |
| COPY | RObject. copy() copyAsync() | RObjectReactive. copy() | RObjectRx. copy() |
| CLIENT SETNAME | Config.setClientName() | - | - |
| CLIENT REPLY | BatchOptions.skipResult() | - | - |
| CLUSTER INFO | ClusterNode.info() | - | - |
| CLUSTER KEYSLOT | RKeys. getSlot() getSlotAsync() | RKeysReactive. getSlot() | RKeysRx. getSlot() |
| CLUSTER NODES | Used in ClusterConnectionManager | ||
| DECRBY | RAtomicLong. addAndGet() addAndGetAsync() | RAtomicLongReactive. addAndGet() | RAtomicLongRx. addAndGet() |
| DUMP | RObject. dump() dumpAsync() | RObjectReactive. dump() | RObjectRx. dump() |
| DBSIZE | RKeys. count() countAsync() | RKeysReactive. count() | RKeysRx.count() |
| DECR | RAtomicLong. decrementAndGet() decrementAndGetAsync() | RAtomicLongReactive. decrementAndGet() | RAtomicLongRx. decrementAndGet() |
| DEL | RObject. delete() deleteAsync() RKeys. delete() deleteAsync() | RObjectReactive. delete() RKeysReactive. delete() | RObjectRx. delete() RKeysRx. delete() |
| STRLEN | RBucket. size() sizeAsync() | RBucketReactive. size() | RBucketRx. size() |
| eval | Rscript. eval() evalAsync() | RscriptReactive. eval() | RscriptRx. eval() |
| evalSHA | Rscript. evalSha() evalShaAsync() | RscriptReactive. evalSha() | RscriptRx. evalSha() |
| EXEC | RBatch. execute() executeAsync() | RBatchReactive. execute() | RBatchRx. execute() |
| EXISTS | RObject. isExists() isExistsAsync() | RObjectReactive. isExists() | RObjectRx. isExists() |
| FLUSHALL | RKeys. flushall() flushallAsync() | RKeysReactive. flushall() | RKeysRx. flushall() |
| FLUSHDB | RKeys. flushdb() flushdbAsync() | RKeysReactive. flushdb() | RKeysRx. flushdb() |
| GETRANGE | RBinaryStream. getChannel().read() | RBinaryStreamReactive. read() | RBinaryStreamRx. read() |
| GEOADD | RGeo. add() addAsync() | RGeoReactive. add() | RGeoRx. add() |
| GEODIST | RGeo. dist() distAsync() | RGeoReactive. dist() | RGeoRx. dist() |
| GEOHASH | RGeo. hash() hashAsync() | RGeoReactive. hash() | RGeoRx. hash() |
| GEOPOS | RGeo. pos() posAsync() | RGeoReactive. pos() | RGeoRx. pos() |
| GEORADIUS | RGeo. radius() radiusAsync() radiusWithDistance() radiusWithDistanceAsync() radiusWithPosition() radiusWithPositionAsync() | RGeoReactive. radius() radiusWithDistance() radiusWithPosition() | RGeoRx. radius() radiusWithDistance() radiusWithPosition() |
| GET | RBucket. get() getAsync() RBinaryStream. get() getAsync() | RBucketReactive. get() RBinaryStreamReactive. get() | RBucketRx. get() RBinaryStreamRx. get() |
| GETBIT | RBitSet. get() getAsync() | RBitSetReactive. get() | RBitSetRx. get() |
| GETSET | RBucket. getAndSet() getAndSetAsync() RAtomicLong. getAndSet() getAndSetAsync() RAtomicDouble. getAndSet() getAndSetAsync() | RBucketReactive. getAndSet() RAtomicLongReactive. getAndSet() RAtomicDoubleReactive. getAndSet() | RBucketRx. getAndSet() RAtomicLongRx. getAndSet() RAtomicDoubleRx. getAndSet() |
| HDEL | RMap. fastRemove() fastRemoveAsync() | RMapReactive. fastRemove() | RMapRx. fastRemove() |
| HEXISTS | RMap. containsKey() containsKeyAsync() | RMapReactive. containsKey() | RMapRx. containsKey() |
| HGET | RMap. get() getAsync() | RMapReactive. get() | RMapRx. get() |
| HSTRLEN | RMap. valueSize() valueSizeAsync() | RMapReactive. valueSize() | RMapRx. valueSize() |
| HGETALL | RMap. readAllEntrySet() readAllEntrySetAsync() | RMapReactive. readAllEntrySet() | RMapRx. readAllEntrySet() |
| HINCRBY | RMap. addAndGet() addAndGetAsync() | RMapReactive. addAndGet() | RMapRx. addAndGet() |
| HINCRBYFLOAT | RMap. addAndGet() addAndGetAsync() | RMapReactive. addAndGet() | RMapRx. addAndGet() |
| HKEYS | RMap. readAllKeySet() readAllKeySetAsync() | RMapReactive. readAllKeySet() | RMapRx. readAllKeySet() |
| HLEN | RMap. size() sizeAsync() | RMapReactive. size() | RMapRx. size() |
| HMGET | RMap. getAll() getAllAsync() | RMapReactive. getAll() | RMapRx. getAll() |
| HMSET | RMap. putAll() putAllAsync() | RMapReactive. putAll() | RMapRx. putAll() |
| HSCAN | RMap. keySet().iterator() values().iterator() entrySet().iterator() | RMapReactive. keyIterator() valueIterator() entryIterator() | RMapRx. keyIterator() valueIterator() entryIterator() |
| HSET | RMap. fastPut() fastPutAsync() | RMapReactive. fastPut() | RMapRx. fastPut() |
| HSETNX | RMap. fastPutIfAbsent() fastPutIfAbsentAsync() | RMapReactive. fastPutIfAbsent() | RMapRx. fastPutIfAbsent() |
| HVALS | RMap. readAllValues() readAllValuesAsync() | RMapReactive. readAllValues() | RMapRx. readAllValues() |
| INCR | RAtomicLong. incrementAndGet() incrementAndGetAsync() | RAtomicLongReactive. incrementAndGet() | RAtomicLongRx. incrementAndGet() |
| INCRBY | RAtomicLong. addAndGet() addAndGetAsync() | RAtomicLongReactive. addAndGet() | RAtomicLongRx. addAndGet() |
| INCRBYFLOAT | RAtomicDouble. addAndGet() addAndGetAsync() | RAtomicDoubleReactive. addAndGet() | RAtomicDoubleRx. addAndGet() |
| KEYS | RKeys. getKeysByPattern() getKeysByPatternAsync() | RKeysReactive. getKeysByPattern() | RKeysRx. getKeysByPattern() |
| LINDEX | RList. get() getAsync() | RListReactive. get() | RListRx. get() |
| LLEN | RList. size() sizeAsync() | RListReactive. size() | RListRx. size() |
| LPOP | RQueue. poll() pollAsync() | RQueueReactive. poll() | RQueueRx. poll() |
| LPUSH | RDeque. addFirst() addFirstAsync() | RDequeReactive. addFirst() | |
| LRANGE | RList. readAll() readAllAsync() | RListReactive.readAll() | RListRx.readAll() |
| LPUSHX | RDeque. addFirstIfExists() addFirstIfExistsAsync() | RDequeReactive. addFirstIfExists() | RDequeRx. addFirstIfExists() |
| LREM | RList. fastRemove() fastRemoveAsync() | RListReactive. fastRemove() | RListRx. fastRemove() |
| LSET | RList. fastSet() fastSetAsync() | RListReactive. fastSet() | RListRx. fastSet() |
| LTRIM | RList. trim() trimAsync() | RListReactive. trim() | RListRx. trim() |
| LINSERT | RList. addBefore() addAfter() addBeforeAsync() addAfterAsync() | RListReactive. addBefore() addAfter() | RListRx. addBefore() addAfter() |
| MULTI | RBatch. execute() executeAsync() | RBatchReactive. execute() | RBatchRx. execute() |
| MGET | RBuckets. get() getAsync() | RBucketsReactive. get() | RBucketsRx. get() |
| MSETNX | RBuckets. trySet() trySetAsync() | RBucketsReactive. trySet() | RBucketsRx. trySet() |
| MIGRATE | RObject. migrate() migrateAsync() | RObjectReactive. migrate() | RObjectRx. migrate() |
| MOVE | RObject. move() moveAsync() | RObjectReactive. move() | RObjectRx. move() |
| MSET | RBuckets. set() setAsync() | RBucketsReactive. set() | RBucketsRx. set() |
| PERSIST | RExpirable. clearExpire() clearExpireAsync() | RExpirableReactive. clearExpire() | RExpirableRx. clearExpire() |
| PEXPIRE | RExpirable. expire() expireAsync() | RExpirableReactive. expire() | RExpirableRx. expire() |
| PEXPIREAT | RExpirable. expireAt() expireAtAsync() | RExpirableReactive. expireAt() | RExpirableRx. expireAt() |
| PFADD | RHyperLogLog. add() addAsync() addAll() addAllAsync() | RHyperLogLogReactive. add() addAll() | RHyperLogLogRx. add() addAll() |
| PFCOUNT | RHyperLogLog. count() countAsync() countWith() countWithAsync() | RHyperLogLogReactive. count() countWith() | RHyperLogLogRx. count() countWith() |
| PFMERGE | RHyperLogLog. mergeWith() mergeWithAsync() | RHyperLogLogReactive. mergeWith() | RHyperLogLogRx. mergeWith() |
| PING | Node.ping() NodesGroup.pingAll() | - | - |
| PSUBSCRIBE | RPatternTopic. addListener() | RPatternTopicReactive. addListener() | RPatternTopicRx. addListener() |
| PSETEX | RBucket. set() setAsync() | RBucketReactive. set() | RBucketRx. set() |
| PTTL | RExpirable. remainTimeToLive() remainTimeToLiveAsync() | RExpirableReactive. remainTimeToLive() | RExpirableRx. remainTimeToLive() |
| PUBLISH | RTopic. publish() | RTopicReactive. publish() | RTopicRx. publish() |
| PUBSUB NUMSUB | RTopic. countSubscribers() countSubscribersAsync() | RTopicReactive. countSubscribers() | RTopicRx. countSubscribers() |
| PUNSUBSCRIBE | RPatternTopic. removeListener() | RPatternTopicReactive. removeListener() | RPatternTopicRx. removeListener() |
| RANDOMKEY | RKeys. randomKey() randomKeyAsync() | RKeysReactive. randomKey() | RKeysRx. randomKey() |
| RESTORE | RObject. restore() restoreAsync() | RObjectReactive. restore() | RObjectRx. restore() |
| RENAME | RObject. rename() renameAsync() | RObjectReactive. rename() | RObjectRx. rename() |
| RPOP | RDeque. pollLast() removeLast() pollLastAsync() removeLastAsync() | RDequeReactive. pollLast() removeLast() | RDequeRx. pollLast() removeLast() |
| RPOPLPUSH | RDeque. pollLastAndOfferFirstTo() pollLastAndOfferFirstToAsync() | RDequeReactive. pollLastAndOfferFirstTo() | RDequeRx. pollLastAndOfferFirstTo() |
| RPUSH | RList. add() addAsync() | RListReactive. add() | RListRx. add() |
| RPUSHX | RDeque. addLastIfExists() addLastIfExistsAsync() | RListReactive. addLastIfExists() | RListRx. addLastIfExists() |
| SADD | RSet. add() addAsync() | RSetReactive. add() | RSetRx. add() |
| SETRANGE | RBinaryStream. getChannel().write() | RBinaryStreamReactive. write() | RBinaryStreamRx. write() |
| SCAN | RKeys. getKeys() | RKeysReactive. getKeys() | RKeysRx. getKeys() |
| SCARD | RSet. size() sizeAsync() | RSetReactive. size() | RSetRx. size() |
| script EXISTS | Rscript. scriptExists() scriptExistsAsync() | RscriptReactive. scriptExists() | RscriptRx. scriptExists() |
| script FLUSH | Rscript. scriptFlush() scriptFlushAsync() | RscriptReactive. scriptFlush() | RscriptRx. scriptFlush() |
| script KILL | Rscript. scriptKill() scriptKillAsync() | RscriptReactive. scriptKill() | RscriptRx. scriptKill() |
| script LOAD | Rscript. scriptLoad() scriptLoadAsync() | RscriptReactive. scriptLoad() | RscriptRx. scriptLoad() |
| SDIFFSTORE | RSet. diff() diffAsync() | RSetReactive. diff() | RSetRx. diff() |
| SDIFF | RSet. readDiff() readDiffAsync() | RSetReactive. readDiff() | RSetRx. readDiff() |
| SRANDMEMBER | RSet. random() randomAsync() | RSetReactive. random() | RSetRx. random() |
| SELECT | Config.setDatabase() | - | - |
| SET | RBucket. set() setAsync() | RBucketReactive. set() | RBucketRx. set() |
| SETBIT | RBitSet. set() clear() setAsync() clearAsync() | RBitSetReactive. set() clear() | RBitSetRx. set() clear() |
| SETEX | RBucket. set() setAsync() | RBucketReactive. set() | RBucketRx. set() |
| SETNX | RBucket. trySet() trySetAsync() | RBucketReactive. trySet() | RBucketRx. trySet() |
| SISMEMBER | RSet. contains() containsAsync() | RSetReactive. contains() | RSetRx. contains() |
| SINTERSTORE | RSet. intersection() intersectionAsync() | RSetReactive. intersection() | RSetRx. intersection() |
| SINTER | RSet. readIntersection() readIntersectionAsync() | RSetReactive. readIntersection() | RSetRx. readIntersection() |
| SMEMBERS | RSet. readAll() readAllAsync() | RSetReactive. readAll() | RSetRx. readAll() |
| SMOVE | RSet. move() moveAsync() | RSetReactive. move() | RSetRx. move() |
| SORT | RList. readSort() sortTo() readSortAsync() sortToAsync() | RListReactive. readSort() sortTo() | RListRx. readSort() sortTo() |
| SPOP | RSet. removeRandom() removeRandomAsync() | RSetReactive. removeRandom() | RSetRx. removeRandom() |
| SREM | RSet. remove() removeAsync() | RSetReactive. remove() | RSetRx. remove() |
| SSCAN | RSet. iterator() | RSetReactive. iterator() | RSetRx. iterator() |
| SUBSCRIBE | RTopic. addListener() | RTopicReactive. addListener() | RTopicRx. addListener() |
| SUNIOn | RSet. readUnion() readUnionAsync() | RSetReactive. readUnion() | RSetRx. readUnion() |
| SUNIOnSTORE | RSet. union() unionAsync() | RSetReactive. union() | RSetRx. union() |
| SWAPDB | RKeys. swapdb() swapdbAsync() | RKeysReactive. swapdb() | RKeysRx. swapdb() |
| TTL | RExpirable. remainTimeToLive() remainTimeToLiveAsync() | RExpirableReactive. remainTimeToLive() | RExpirableRx. remainTimeToLive() |
| TYPE | RKeys. getType() getTypeAsync() | RKeysReactive. getType() | RKeysRx. getType() |
| TOUCH | RObject. touch() touchAsync() | RObjectReactive. touch() | RObjectRx. touch() |
| UNSUBSCRIBE | RTopic. removeListener() | RTopicReactive. removeListener() | RTopicRx. removeListener() |
| UNlink | RObject. unlink() unlinkAsync() | RObjectReactive. unlink() | RObjectRx. unlink() |
| WAIT | BatchOptions. syncSlaves() | BatchOptions. syncSlaves() | BatchOptions. syncSlaves() |
| ZADD | RScoredSortedSet. add() addAsync() | RScoredSortedSetReactive. add() | RScoredSortedSetRx. add() |
| ZCARD | RScoredSortedSet. size() sizeAsync() | RScoredSortedSetReactive. size() | RScoredSortedSetRx. size() |
| ZCOUNT | RScoredSortedSet. count() countAsync() | RScoredSortedSetReactive. count() | RScoredSortedSetRx. count() |
| ZINCRBY | RScoredSortedSet. addScore() addScoreAsync() | RScoredSortedSetReactive. addScore() | RScoredSortedSetRx. addScore() |
| ZREMRANGEBYRANK | RScoredSortedSet. removeRangeByRank() removeRangeByRankAsync() | RScoredSortedSetReactive. removeRangeByRank() | RScoredSortedSetRx. removeRangeByRank() |
| ZREVRANGEBYLEX | RLexSortedSet. rangeReversed() rangeReversedAsync() | RLexSortedSetReactive. rangeReversed() | RLexSortedSetSetRx. rangeReversed() |
| ZLEXCOUNT | RLexSortedSet. lexCount() lexCountHead() lexCountTail() lexCountAsync() lexCountHeadAsync() lexCountTailAsync() | RLexSortedSetReactive. lexCount() lexCountHead() lexCountTail() | RLexSortedSetRx. lexCount() lexCountHead() lexCountTail() |
| ZRANGE | RScoredSortedSet. valueRange() valueRangeAsync() | RScoredSortedSetReactive. valueRange() | RScoredSortedSetRx. valueRange() |
| ZREVRANGE | RScoredSortedSet. valueRangeReversed() valueRangeReversedAsync() | RScoredSortedSetReactive. valueRangeReversed() | RScoredSortedSetRx. valueRangeReversed() |
| ZUNIOnSTORE | RScoredSortedSet. union() unionAsync() | RScoredSortedSetReactive. union() | RScoredSortedSetRx. union() |
| ZINTERSTORE | RScoredSortedSet. intersection() intersectionAsync() | RScoredSortedSetReactive. intersection() | RScoredSortedSetRx. intersection() |
| ZRANGEBYLEX | RLexSortedSet. range() rangeHead() rangeTail() rangeAsync() rangeHeadAsync() rangeTailAsync() | RLexSortedSetReactive. range() rangeHead() rangeTail() | RLexSortedSetRx. range() rangeHead() rangeTail() |
| ZRANGEBYSCORE | RScoredSortedSet. valueRange() entryRange() valueRangeAsync() entryRangeAsync() | RScoredSortedSetReactive. valueRange() entryRange() | RScoredSortedSetRx. valueRange() entryRange() |
| TIME | RedissonClient. getNodesGroup(). getNode().time() getClusterNodesGroup(). getNode().time() | - | - |
| ZRANK | RScoredSortedSet. rank() rankAsync() | RScoredSortedSetReactive. rank() | RScoredSortedSetRx. rank() |
| ZREM | RScoredSortedSet. remove() removeAll() removeAsync() removeAllAsync() | RScoredSortedSetReactive. remove() removeAll() | RScoredSortedSetRx. remove() removeAll() |
| ZREMRANGEBYLEX | RLexSortedSet. removeRange() removeRangeHead() removeRangeTail() removeRangeAsync() removeRangeHeadAsync() removeRangeTailAsync() | RLexSortedSetReactive. removeRange() removeRangeHead() removeRangeTail() | RLexSortedSetRx. removeRange() removeRangeHead() removeRangeTail() |
| ZREMRANGEBYSCORE | RScoredSortedSet. removeRangeByScore() removeRangeByScoreAsync() | RScoredSortedSetReactive. removeRangeByScore() | RScoredSortedSetRx. removeRangeByScore() |
| ZREVRANGEBYSCORE | RScoredSortedSet. valueRangeReversed() entryRangeReversed() valueRangeReversedAsync() entryRangeReversedAsync() | RScoredSortedSetReactive. entryRangeReversed() valueRangeReversed() | RScoredSortedSetRx. entryRangeReversed() valueRangeReversed() |
| ZREVRANK | RScoredSortedSet. revRank() revRankAsync() | RScoredSortedSetReactive. revRank() | RScoredSortedSetRx. revRank() |
| ZSCORE | RScoredSortedSet. getScore() getScoreAsync() | RScoredSortedSetReactive. getScore() | RScoredSortedSetRx. getScore() |
| ZPOPMAX | RScoredSortedSet. pollLast() pollLastAsync() | RScoredSortedSetReactive. pollLast() | RScoredSortedSetRx. pollLast() |
| ZPOPMIN | RScoredSortedSet. pollFirst() pollFirstAsync() | RScoredSortedSetReactive. pollFirst() | RScoredSortedSetRx. pollFirst() |
| XACK | RStream. ack() ackAsync() | RStreamReactive. ack() | RStreamRx. ack() |
| XADD | RStream. add() addAsync() | RStreamReactive. add() | RStreamRx. add() |
| XCLAIM | RStream. claim() claimAsync() | RStreamReactive. claim() | RStreamRx. claim() |
| XDEL | RStream. remove() removeAsync() | RStreamReactive. remove() | RStreamRx. remove() |
| XGROUP | RStream. createGroup() removeGroup() updateGroup() createGroupAsync() removeGroupAsync() updateGroupAsync() | RStreamReactive. createGroup() removeGroup() updateGroup() | RStreamRx. createGroup() removeGroup() updateGroup() |
| XINFO | RStream. getInfo() listGroups() listConsumers() getInfoAsync() listGroupsAsync() listConsumersAsync() | RStreamReactive. getInfo() listGroups() listConsumers() | RStreamRx. getInfo() listGroups() listConsumers() |
| XLEN | RStream. size() sizeAsync() | RStreamReactive. size() | RStreamRx. size() |
| XPENDING | RStream. listPending() listPendingAsync() | RStreamReactive. listPending() | RStreamRx. listPending() |
| XRANGE | RStream. range() rangeAsync() | RStreamReactive. range() | RStreamRx. range() |
| XREAD | RStream. read() readAsync() | RStreamReactive. read() | RStreamRx. read() |
| XREADGROUP | RStream. readGroup() readGroupAsync() | RStreamReactive. readGroup() | RStreamRx. readGroup() |
| XREVRANGE | RStream. rangeReversed() rangeReversedAsync() | RStreamReactive. rangeReversed() | RStreamRx. rangeReversed() |
| XTRIM | RStream. trim() trimAsync() | RStreamReactive. trim() | RStreamRx. trim() |
Redisson最新版starter模式集成_明洋的专栏-CSDN博客_redisson-spring-boot-starter
最简单的spring-boot-starter-redisson发布啦! | 纳兰小筑



