Spring Reactive Redis

String 类型

// 设置键的值
Mono<Boolean> set(K key, V value); // 将值 "value" 设置到键 "key"

// 设置键的值,带超时
Mono<Boolean> set(K key, V value, Duration timeout); // 将值 "value" 设置到键 "key",并设置超时时间

// 如果键不存在,则设置值
Mono<Boolean> setIfAbsent(K key, V value); // 仅在键 "key" 不存在时将值 "value" 设置到键 "key"

// 如果键不存在,则设置值,带超时
Mono<Boolean> setIfAbsent(K key, V value, Duration timeout); // 仅在键 "key" 不存在时将值 "value" 设置到键 "key",并设置超时时间

// 如果键存在,则设置值
Mono<Boolean> setIfPresent(K key, V value); // 仅在键 "key" 存在时将值 "value" 设置到键 "key"

// 如果键存在,则设置值,带超时
Mono<Boolean> setIfPresent(K key, V value, Duration timeout); // 仅在键 "key" 存在时将值 "value" 设置到键 "key",并设置超时时间

// 批量设置键值对
Mono<Boolean> multiSet(Map<? extends K, ? extends V> map); // 将多个键值对设置到 Redis

// 批量设置键值对,仅在键不存在时
Mono<Boolean> multiSetIfAbsent(Map<? extends K, ? extends V> map); // 将多个键值对设置到 Redis,仅在键不存在时

// 获取指定键的值
Mono<V> get(Object key); // 获取键 "key" 的值

// 获取并删除指定键的值
Mono<V> getAndDelete(K key); // 获取并删除键 "key" 的值

// 获取并设置键的超时
Mono<V> getAndExpire(K key, Duration timeout); // 获取键 "key" 的值并设置超时

// 获取并持久化键的值
Mono<V> getAndPersist(K key); // 获取键 "key" 的值并持久化

// 获取键的值并设置新值
Mono<V> getAndSet(K key, V value); // 获取键 "key" 的值并将其设置为新值 "value"

// 批量获取多个键的值
Mono<List<V>> multiGet(Collection<K> keys); // 获取多个键的值

// 增加键的值(整数)
Mono<Long> increment(K key); // 将键 "key" 的值增加 1

// 增加键的值(整数),指定增量
Mono<Long> increment(K key, long delta); // 将键 "key" 的值增加指定的增量 "delta"

// 增加键的值(浮点数),指定增量
Mono<Double> increment(K key, double delta); // 将键 "key" 的值增加指定的增量 "delta"

// 减少键的值(整数)
Mono<Long> decrement(K key); // 将键 "key" 的值减少 1

// 减少键的值(整数),指定减量
Mono<Long> decrement(K key, long delta); // 将键 "key" 的值减少指定的减量 "delta"

// 在键的值后追加字符串
Mono<Long> append(K key, String value); // 将字符串 "value" 追加到键 "key" 的值后

// 获取键的指定范围内的值
Mono<String> get(K key, long start, long end); // 获取键 "key" 的值的指定范围

// 设置键的值,指定偏移量
Mono<Long> set(K key, V

Hash

// 获取指定范围内的元素
Flux<V> range(K key, long start, long end); // 获取哈希表 "key" 中从 start 到 end 的元素

// 修剪列表,保留指定范围内的元素
Mono<Boolean> trim(K key, long start, long end); // 修剪哈希表 "key",只保留从 start 到 end 的元素

// 获取列表的大小
Mono<Long> size(K key); // 获取哈希表 "key" 中元素的数量

// 从左侧推送元素
Mono<Long> leftPush(K key, V value); // 将元素 "value" 推送到哈希表 "key" 的左侧

// 从左侧推送多个元素
Mono<Long> leftPushAll(K key, V... values); // 将多个元素推送到哈希表 "key" 的左侧
Mono<Long> leftPushAll(K key, Collection<V> values); // 将多个元素推送到哈希表 "key" 的左侧

// 如果键存在,则从左侧推送元素
Mono<Long> leftPushIfPresent(K key, V value); // 仅在哈希表 "key" 存在时将元素 "value" 推送到左侧

// 在指定元素之前推送元素
Mono<Long> leftPush(K key, V pivot, V value); // 在哈希表 "key" 中元素 "pivot" 之前推送元素 "value"

// 从右侧推送元素
Mono<Long> rightPush(K key, V value); // 将元素 "value" 推送到哈希表 "key" 的右侧

// 从右侧推送多个元素
Mono<Long> rightPushAll(K key, V... values); // 将多个元素推送到哈希表 "key" 的右侧
Mono<Long> rightPushAll(K key, Collection<V> values); // 将多个元素推送到哈希表 "key" 的右侧

// 如果键存在,则从右侧推送元素
Mono<Long> rightPushIfPresent(K key, V value); // 仅在哈希表 "key" 存在时将元素 "value" 推送到右侧

// 在指定元素之后推送元素
Mono<Long> rightPush(K key, V pivot, V value); // 在哈希表 "key" 中元素 "pivot" 之后推送元素 "value"

// 移动元素
default Mono<V> move(ListOperations.MoveFrom<K> from, ListOperations.MoveTo<K> to) {
    Assert.notNull(from, "Move from must not be null");
    Assert.notNull(to, "Move to must not be null");
    return this.move(from.key, Direction.valueOf(from.direction.name()), to.key, Direction.valueOf(to.direction.name()));
}

// 移动元素
Mono<V> move(K sourceKey, ReactiveListCommands.Direction from, K destinationKey, ReactiveListCommands.Direction to); // 从一个列表移动元素到另一个列表

// 带超时的移动元素
default Mono<V> move(ListOperations.MoveFrom<K> from, ListOperations.MoveTo<K> to, Duration timeout) {
    Assert.notNull(from, "Move from must not be null");
    Assert.notNull(to, "Move to must not be null");
    Assert.notNull(timeout, "Timeout must not be null");
    Assert.isTrue(!timeout.isNegative(), "Timeout must not be negative");
    return this.move(from.key, Direction.valueOf(from.direction.name()), to.key, Direction.valueOf(to.direction.name()), timeout);
}

// 带超时的移动元素
Mono<V> move(K sourceKey, ReactiveListCommands.Direction from, K destinationKey, ReactiveListCommands.Direction to, Duration timeout);

// 设置指定索引的值
Mono<Boolean> set(K key, long index, V value); // 设置哈希表 "key" 中指定索引的值为 "value"

// 移除指定值的元素
Mono<Long> remove(K key, long count, Object value); // 从哈希表 "key" 中移除指定数量的值为 "value" 的元素

// 获取指定索引的元素
Mono<V> index(K key, long index); // 获取哈希表 "key" 中指定索引的元素

// 获取指定值的索引
Mono<Long> indexOf(K key, V value); // 获取哈希表 "key" 中值为 "value" 的第一个索引

// 获取指定值的最后索引
Mono<Long> lastIndexOf(K key, V value); // 获取哈希表 "key" 中值为 "value" 的最后一个索引

// 从左侧弹出元素
Mono<V> leftPop(K key); // 从哈希表 "key" 的左侧弹出一个元素

// 从左侧弹出多个元素
Flux<V> leftPop(K key, long count); // 从哈希表 "key" 的左侧弹出多个元素

// 从左侧弹出元素,带超时
Mono<V> leftPop(K key, Duration timeout); // 从哈希表 "key" 的左侧弹出一个元素,带超时

// 从右侧弹出元素
Mono<V> rightPop(K key); // 从哈希表 "key" 的右侧弹出一个元素

// 从右侧弹出多个元素
Flux<V> rightPop(K key, long count); // 从哈希表 "key" 的右侧弹出多个元素

// 从右侧弹出元素,带超时
Mono<V> rightPop(K key, Duration timeout); // 从哈希表 "key" 的右侧弹出一个元素,带超时

// 从右侧弹出元素并左推到另一个列表
Mono<V> rightPopAndLeftPush(K sourceKey, K destinationKey); // 从哈希表 "sourceKey" 的右侧弹出一个元素并推送到 "destinationKey" 的左侧

// 从右侧弹出元素并左推到另一个列表,带超时
Mono<V> rightPopAndLeftPush(K sourceKey, K destinationKey, Duration timeout); // 从哈希表 "sourceKey" 的右侧弹出一个元素并推送到 "destinationKey" 的左侧,带超时

// 删除指定键
Mono<Boolean> delete(K key); // 删除哈希表 "key"

Set

// 添加一个或多个元素到集合
Mono<Long> add(K key, V... values); // 将一个或多个元素 "values" 添加到集合 "key"

// 移除一个或多个元素
Mono<Long> remove(K key, Object... values); // 从集合 "key" 中移除一个或多个元素 "values"

// 弹出集合中的一个元素
Mono<V> pop(K key); // 从集合 "key" 中弹出一个元素

// 弹出集合中的多个元素
Flux<V> pop(K key, long count); // 从集合 "key" 中弹出多个元素

// 将元素从一个集合移动到另一个集合
Mono<Boolean> move(K sourceKey, V value, K destKey); // 将元素 "value" 从集合 "sourceKey" 移动到集合 "destKey"

// 获取集合的大小
Mono<Long> size(K key); // 获取集合 "key" 中元素的数量

// 检查元素是否是集合的成员
Mono<Boolean> isMember(K key, Object o); // 检查元素 "o" 是否是集合 "key" 的成员

// 检查多个元素是否是集合的成员
Mono<Map<Object, Boolean>> isMember(K key, Object... objects); // 检查多个元素是否是集合 "key" 的成员

// 计算两个集合的交集
Flux<V> intersect(K key, K otherKey); // 获取集合 "key" 和 "otherKey" 的交集

// 计算集合与多个集合的交集
Flux<V> intersect(K key, Collection<K> otherKeys); // 获取集合 "key" 和多个集合的交集

// 计算多个集合的交集
Flux<V> intersect(Collection<K> keys); // 获取多个集合的交集

// 计算交集并存储结果到目标集合
Mono<Long> intersectAndStore(K key, K otherKey, K destKey); // 计算集合 "key" 和 "otherKey" 的交集并存储到 "destKey"

Mono<Long> intersectAndStore(K key, Collection<K> otherKeys, K destKey); // 计算集合 "key" 和多个集合的交集并存储到 "destKey"

Mono<Long> intersectAndStore(Collection<K> keys, K destKey); // 计算多个集合的交集并存储到 "destKey"

// 计算两个集合的并集
Flux<V> union(K key, K otherKey); // 获取集合 "key" 和 "otherKey" 的并集

// 计算集合与多个集合的并集
Flux<V> union(K key, Collection<K> otherKeys); // 获取集合 "key" 和多个集合的并集

// 计算多个集合的并集
Flux<V> union(Collection<K> keys); // 获取多个集合的并集

// 计算并集并存储结果到目标集合
Mono<Long> unionAndStore(K key, K otherKey, K destKey); // 计算集合 "key" 和 "otherKey" 的并集并存储到 "destKey"

Mono<Long> unionAndStore(K key, Collection<K> otherKeys, K destKey); // 计算集合 "key" 和多个集合的并集并存储到 "destKey"

Mono<Long> unionAndStore(Collection<K> keys, K destKey); // 计算多个集合的并集并存储到 "destKey"

// 计算两个集合的差集
Flux<V> difference(K key, K otherKey); // 获取集合 "key" 和 "otherKey" 的差集

// 计算集合与多个集合的差集
Flux<V> difference(K key, Collection<K> otherKeys); // 获取集合 "key" 和多个集合的差集

// 计算多个集合的差集
Flux<V> difference(Collection<K> keys); // 获取多个集合的差集

// 计算差集并存储结果到目标集合
Mono<Long> differenceAndStore(K key, K otherKey, K destKey); // 计算集合 "key" 和 "otherKey" 的差集并存储到 "destKey"

Mono<Long> differenceAndStore(K key, Collection<K> otherKeys, K destKey); // 计算集合 "key" 和多个集合的差集并存储到 "destKey"

Mono<Long> differenceAndStore(Collection<K> keys, K destKey); // 计算多个集合的差集并存储到 "destKey"

// 获取集合的所有成员
Flux<V> members(K key); // 获取集合 "key" 中的所有成员

// 扫描集合中的元素
default Flux<V> scan(K key) {
    return this.scan(key, ScanOptions.NONE);
}

// 扫描集合中的元素,带选项
Flux<V> scan(K key, ScanOptions options); // 扫描集合 "key" 中的元素,带扫描选项

// 获取集合中的随机成员
Mono<V> randomMember(K key); // 获取集合 "key" 中的随机成员

// 获取集合中的多个随机成员
Flux<V> distinctRandomMembers(K key, long count); // 获取集合 "key" 中的多个不同随机成员

// 获取集合中的多个随机成员
Flux<V> randomMembers(K key, long count); // 获取集合 "key" 中的多个随机成员

// 删除集合
Mono<Boolean> delete(K key); // 删除集合 "key"

Zset

// 添加元素到有序集合,指定分数
Mono<Boolean> add(K key, V value, double score); // 将元素 "value" 添加到有序集合 "key",并指定分数 "score"

// 添加多个元素到有序集合
Mono<Long> addAll(K key, Collection<? extends ZSetOperations.TypedTuple<V>> tuples); // 将多个元素添加到有序集合 "key"

// 移除元素
Mono<Long> remove(K key, Object... values); // 从有序集合 "key" 中移除一个或多个元素 "values"

// 增加元素的分数
Mono<Double> incrementScore(K key, V value, double delta); // 增加有序集合 "key" 中元素 "value" 的分数 "delta"

// 获取随机成员
Mono<V> randomMember(K key); // 从有序集合 "key" 中获取一个随机成员

// 获取多个不同的随机成员
Flux<V> distinctRandomMembers(K key, long count); // 从有序集合 "key" 中获取多个不同的随机成员

// 获取多个随机成员
Flux<V> randomMembers(K key, long count); // 从有序集合 "key" 中获取多个随机成员

// 获取随机成员及其分数
Mono<ZSetOperations.TypedTuple<V>> randomMemberWithScore(K key); // 获取有序集合 "key" 中的随机成员及其分数

// 获取多个不同的随机成员及其分数
Flux<ZSetOperations.TypedTuple<V>> distinctRandomMembersWithScore(K key, long count); // 获取多个不同的随机成员及其分数

// 获取多个随机成员及其分数
Flux<ZSetOperations.TypedTuple<V>> randomMembersWithScore(K key, long count); // 获取多个随机成员及其分数

// 获取元素的排名
Mono<Long> rank(K key, Object o); // 获取有序集合 "key" 中元素 "o" 的排名

// 获取元素的反向排名
Mono<Long> reverseRank(K key, Object o); // 获取有序集合 "key" 中元素 "o" 的反向排名

// 获取指定范围内的元素
Flux<V> range(K key, Range<Long> range); // 获取有序集合 "key" 中指定范围内的元素

// 获取指定范围内的元素及其分数
Flux<ZSetOperations.TypedTuple<V>> rangeWithScores(K key, Range<Long> range); // 获取有序集合 "key" 中指定范围内的元素及其分数

// 根据分数范围获取元素
Flux<V> rangeByScore(K key, Range<Double> range); // 获取有序集合 "key" 中指定分数范围内的元素

// 根据分数范围获取元素及其分数
Flux<ZSetOperations.TypedTuple<V>> rangeByScoreWithScores(K key, Range<Double> range); // 获取有序集合 "key" 中指定分数范围内的元素及其分数

// 根据分数范围获取元素,带限制
Flux<V> rangeByScore(K key, Range<Double> range, Limit limit); // 获取有序集合 "key" 中指定分数范围内的元素,带限制

// 根据分数范围获取元素及其分数,带限制
Flux<ZSetOperations.TypedTuple<V>> rangeByScoreWithScores(K key, Range<Double> range, Limit limit); // 获取有序集合 "key" 中指定分数范围内的元素及其分数,带限制

// 获取反向范围内的元素
Flux<V> reverseRange(K key, Range<Long> range); // 获取有序集合 "key" 中反向范围内的元素

// 获取反向范围内的元素及其分数
Flux<ZSetOperations.TypedTuple<V>> reverseRangeWithScores(K key, Range<Long> range); // 获取有序集合 "key" 中反向范围内的元素及其分数

// 获取反向分数范围内的元素
Flux<V> reverseRangeByScore(K key, Range<Double> range); // 获取有序集合 "key" 中反向分数范围内的元素

// 获取反向分数范围内的元素及其分数
Flux<ZSetOperations.TypedTuple<V>> reverseRangeByScoreWithScores(K key, Range<Double> range); // 获取有序集合 "key" 中反向分数范围内的元素及其分数

// 获取反向分数范围内的元素,带限制
Flux<V> reverseRangeByScore(K key, Range<Double> range, Limit limit); // 获取有序集合 "key" 中反向分数范围内的元素,带限制

// 获取反向分数范围内的元素及其分数,带限制
Flux<ZSetOperations.TypedTuple<V>> reverseRangeByScoreWithScores(K key, Range<Double> range, Limit limit); // 获取有序集合 "key" 中反向分数范围内的元素及其分数,带限制

// 根据字典顺序范围获取元素并存储到目标集合
default Mono<Long> rangeAndStoreByLex(K srcKey, K dstKey, Range<String> range) {
    return this.rangeAndStoreByLex(srcKey, dstKey, range, Limit.unlimited());
}

// 根据字典顺序范围获取元素并存储到目标集合,带限制
Mono<Long> rangeAndStoreByLex(K srcKey, K dstKey, Range<String> range, Limit limit);

// 根据字典顺序范围获取元素并存储到目标集合,反向
default Mono<Long> reverseRangeAndStoreByLex(K srcKey, K dstKey, Range<String> range) {
    return this.reverseRangeAndStoreByLex(srcKey, dstKey, range, Limit.unlimited());
}

// 根据字典顺序范围获取元素并存储到目标集合,反向,带限制
Mono<Long> reverseRangeAndStoreByLex(K srcKey, K dstKey, Range<String> range, Limit limit);

// 根据分数范围获取元素并存储到目标集合
default Mono<Long> rangeAndStoreByScore(K srcKey, K dstKey, Range<Double> range) {
    return this.rangeAndStoreByScore(srcKey, dstKey, range, Limit.unlimited());
}

// 根据分数范围获取元素并存储到目标集合,带限制
Mono<Long> rangeAndStoreByScore(K srcKey, K dstKey, Range<Double> range, Limit limit);

// 根据分数范围获取元素并存储到目标集合,反向
default Mono<Long> reverseRangeAndStoreByScore(K srcKey, K dstKey, Range<Double> range) {
    return this.reverseRangeAndStoreByScore(srcKey, dstKey, range, Limit.unlimited());
}

// 根据分数范围获取元素并存储到目标集合,反向,带限制
Mono<Long> reverseRangeAndStoreByScore(K srcKey, K dstKey, Range<Double> range, Limit limit);

// 扫描有序集合中的元素
default Flux<ZSetOperations.TypedTuple<V>> scan(K key) {
    return this.scan(key, ScanOptions.NONE);
}

// 扫描有序集合中的元素,带选项
Flux<ZSetOperations.TypedTuple<V>> scan(K key, ScanOptions options);

// 计算指定分数范围内的元素数量
Mono<Long> count(K key, Range<Double> range); // 计算有序集合 "key" 中指定分数范围内的元素数量

// 计算字典顺序范围内的元素数量
Mono<Long> lexCount(K key, Range<String> range); // 计算有序集合 "key" 中指定字典顺序范围内的元素数量

// 弹出最小分数的元素
Mono<ZSetOperations.TypedTuple<V>> popMin(K key); // 从有序集合 "key" 中弹出最小分数的元素

// 弹出多个最小分数的元素
Flux<ZSetOperations.TypedTuple<V>> popMin(K key, long count); // 从有序集合 "key" 中弹出多个最小分数的元素

// 弹出最小分数的元素,带超时
Mono<ZSetOperations.TypedTuple<V>> popMin(K key, Duration timeout); // 从有序集合 "key" 中弹出最小分数的元素,带超时

// 弹出最大分数的元素
Mono<ZSetOperations.TypedTuple<V>> popMax(K key); // 从有序集合 "key" 中弹出最大分数的元素

// 弹出多个最大分数的元素
Flux<ZSetOperations.TypedTuple<V>> popMax(K key, long count); // 从有序集合 "key" 中弹出多个最大分数的元素

// 弹出最大分数的元素,带超时
Mono<ZSetOperations.TypedTuple<V>> popMax(K key, Duration timeout); // 从有序集合 "key" 中弹出最大分数的元素,带超时

// 获取集合的大小
Mono<Long> size(K key); // 获取有序集合 "key" 中元素的数量

// 获取元素的分数
Mono<Double> score(K key, Object o); // 获取有序集合 "key" 中元素 "o" 的分数

// 获取多个元素的分数
Mono<List<Double>> score(K key, Object... o); // 获取有序集合 "key" 中多个元素的分数

// 移除指定范围内的元素
Mono<Long> removeRange(K key, Range<Long> range); // 从有序集合 "key" 中移除指定范围内的元素

// 移除字典顺序范围内的元素
Mono<Long> removeRangeByLex(K key, Range<String> range); // 从有序集合 "key" 中移除字典顺序范围内的元素

// 移除分数范围内的元素
Mono<Long> removeRangeByScore(K key, Range<Double> range); // 从有序集合 "key" 中移除分数范围内的元素

// 计算集合的差集
default Flux<V> difference(K key, K otherKey) {
    return this.difference(key, (Collection)Collections.singleton(otherKey));
}

// 计算集合的差集,多个集合
Flux<V> difference(K key, Collection<K> otherKeys); // 计算有序集合 "key" 和多个集合的差集

// 计算集合的差集及其分数
default Flux<ZSetOperations.TypedTuple<V>> differenceWithScores(K key, K otherKey) {
    return this.differenceWithScores(key, (Collection)Collections.singleton(otherKey));
}

// 计算集合的差集及其分数,多个集合
Flux<ZSetOperations.TypedTuple<V>> differenceWithScores(K key, Collection<K> otherKeys); // 计算有序集合 "key" 和多个集合的差集及其分数

// 计算差集并存储结果
default Mono<Long> differenceAndStore(K key, K otherKey, K destKey) {
    return this.differenceAndStore(key, (Collection)Collections.singleton(otherKey), destKey);
}

// 计算差集并存储结果,多个集合
Mono<Long> differenceAndStore(K key, Collection<K> otherKeys, K destKey); // 计算有序集合 "key" 和多个集合的差集并存储到 "destKey"

// 计算集合的交集
default Flux<V> intersect(K key, K otherKey) {
    return this.intersect(key, (Collection)Collections.singleton(otherKey));
}

// 计算集合的交集,多个集合
Flux<V> intersect(K key, Collection<K> otherKeys); // 计算有序集合 "key" 和多个集合的交集

// 计算集合的交集及其分数
default Flux<ZSetOperations.TypedTuple<V>> intersectWithScores(K key, K otherKey) {
    return this.intersectWithScores(key, (Collection)Collections.singleton(otherKey));
}

// 计算集合的交集及其分数,多个集合
Flux<ZSetOperations.TypedTuple<V>> intersectWithScores(K key, Collection<K> otherKeys); // 计算有序集合 "key" 和多个集合的交集及其分数

// 计算交集并存储结果
default Mono<Long> intersectAndStore(K key, K otherKey, K destKey) {
    return this.intersectAndStore(key, (Collection)Collections.singleton(otherKey), destKey);
}

// 计算交集并存储结果,多个集合
Mono<Long> intersectAndStore(K key, Collection<K> otherKeys, K destKey); // 计算有序集合 "key" 和多个集合的交集并存储到 "destKey"

// 计算交集并存储结果,带聚合
Mono<Long> intersectAndStore(K key, Collection<K> otherKeys, K destKey, Aggregate aggregate, Weights weights); // 计算有序集合 "key" 和多个集合的交集并存储到 "destKey",带聚合和权重

// 计算并集
default Flux<V> union(K key, K otherKey) {
    return this.union(key, (Collection)Collections.singleton(otherKey));
}

// 计算并集,多个集合
Flux<V> union(K key, Collection<K> otherKeys); // 计算有序集合 "key" 和多个集合的并集

// 计算并集及其分数
default Flux<ZSetOperations.TypedTuple<V>> unionWithScores(K key, K otherKey) {
    return this.unionWithScores(key, (Collection)Collections.singleton(otherKey));
}

// 计算并集及其分数,多个集合
Flux<ZSetOperations.TypedTuple<V>> unionWithScores(K key, Collection<K> otherKeys); // 计算有序集合 "key" 和多个集合的并集及其分数

// 计算并集并存储结果
Mono<Long> unionAndStore(K key, K otherKey, K destKey); // 计算有序集合 "key" 和 "otherKey" 的并集并存储到 "destKey"

// 计算并集并存储结果,多个集合
Mono<Long> unionAndStore(K key, Collection<K> otherKeys, K destKey); // 计算有序集合 "key" 和多个集合的并集并存储到 "destKey"

// 根据字典顺序范围获取元素
Flux<V> rangeByLex(K key, Range<String> range); // 获取有序集合 "key" 中指定字典顺序范围内的元素

// 根据字典顺序范围获取元素,带限制
Flux<V> rangeByLex(K key, Range<String> range, Limit limit); // 获取有序集合 "key" 中指定字典顺序范围内的元素,带限制

// 获取反向字典顺序范围内的元素
Flux<V> reverseRangeByLex(K key, Range<String> range); // 获取有序集合 "key" 中反向字典顺序范围内的元素

// 获取反向字典顺序范围内的元素,带限制
Flux<V> reverseRangeByLex(K key, Range<String> range, Limit limit); // 获取有序集合 "key" 中反向字典顺序范围内的元素,带限制

// 删除集合
Mono<Boolean> delete(K key); // 删除有序集合 "key"

Geo

// 添加一个地理位置
Mono<Long> add(K key, Point point, M member); // 将地理位置 "point" 和成员 "member" 添加到键 "key"

// 添加一个地理位置
Mono<Long> add(K key, RedisGeoCommands.GeoLocation<M> location); // 将地理位置 "location" 添加到键 "key"

// 添加多个地理位置
Mono<Long> add(K key, Map<M, Point> memberCoordinateMap); // 将多个地理位置添加到键 "key"

// 添加多个地理位置
Mono<Long> add(K key, Iterable<RedisGeoCommands.GeoLocation<M>> locations); // 将多个地理位置添加到键 "key"

// 添加多个地理位置,使用 Publisher
Flux<Long> add(K key, Publisher<? extends Collection<RedisGeoCommands.GeoLocation<M>>> locations); // 将多个地理位置添加到键 "key"

// 计算两个成员之间的距离
Mono<Distance> distance(K key, M member1, M member2); // 计算键 "key" 中成员 "member1" 和 "member2" 之间的距离

// 计算两个成员之间的距离,使用指定的度量
Mono<Distance> distance(K key, M member1, M member2, Metric metric); // 计算键 "key" 中成员 "member1" 和 "member2" 之间的距离,使用指定的度量

// 获取成员的哈希值
Mono<String> hash(K key, M member); // 获取键 "key" 中成员 "member" 的哈希值

// 获取多个成员的哈希值
Mono<List<String>> hash(K key, M... members); // 获取键 "key" 中多个成员的哈希值

// 获取成员的位置
Mono<Point> position(K key, M member); // 获取键 "key" 中成员 "member" 的位置

// 获取多个成员的位置
Mono<List<Point>> position(K key, M... members); // 获取键 "key" 中多个成员的位置

// 根据圆形范围获取成员
Flux<GeoResult<RedisGeoCommands.GeoLocation<M>>> radius(K key, Circle within); // 获取键 "key" 中在圆形范围 "within" 内的成员

// 根据圆形范围获取成员,带参数
Flux<GeoResult<RedisGeoCommands.GeoLocation<M>>> radius(K key, Circle within, RedisGeoCommands.GeoRadiusCommandArgs args); // 获取键 "key" 中在圆形范围 "within" 内的成员,带参数

// 根据成员和半径获取成员
Flux<GeoResult<RedisGeoCommands.GeoLocation<M>>> radius(K key, M member, double radius); // 获取键 "key" 中以成员 "member" 为中心,半径为 "radius" 的成员

// 根据成员和距离获取成员
Flux<GeoResult<RedisGeoCommands.GeoLocation<M>>> radius(K key, M member, Distance distance); // 获取键 "key" 中以成员 "member" 为中心,距离为 "distance" 的成员

// 根据成员和距离获取成员,带参数
Flux<GeoResult<RedisGeoCommands.GeoLocation<M>>> radius(K key, M member, Distance distance, RedisGeoCommands.GeoRadiusCommandArgs args); // 获取键 "key" 中以成员 "member" 为中心,距离为 "distance" 的成员,带参数

// 移除成员
Mono<Long> remove(K key, M... members); // 从键 "key" 中移除一个或多个成员

// 删除键
Mono<Boolean> delete(K key); // 删除键 "key"

// 根据圆形范围搜索成员
default Flux<GeoResult<RedisGeoCommands.GeoLocation<M>>> search(K key, Circle within) {
    return this.search(key, GeoReference.fromCircle(within), GeoShape.byRadius(within.getRadius()), GeoSearchCommandArgs.newGeoSearchArgs());
}

// 根据地理参考和距离搜索成员
default Flux<GeoResult<RedisGeoCommands.GeoLocation<M>>> search(K key, GeoReference<M> reference, Distance radius) {
    return this.search(key, reference, radius, GeoSearchCommandArgs.newGeoSearchArgs());
}

// 根据地理参考、距离和参数搜索成员
default Flux<GeoResult<RedisGeoCommands.GeoLocation<M>>> search(K key, GeoReference<M> reference, Distance radius, RedisGeoCommands.GeoSearchCommandArgs args) {
    return this.search(key, reference, GeoShape.byRadius(radius), args);
}

// 根据地理参考和边界框搜索成员
default Flux<GeoResult<RedisGeoCommands.GeoLocation<M>>> search(K key, GeoReference<M> reference, BoundingBox boundingBox) {
    return this.search(key, reference, boundingBox, GeoSearchCommandArgs.newGeoSearchArgs());
}

// 根据地理参考、边界框和参数搜索成员
default Flux<GeoResult<RedisGeoCommands.GeoLocation<M>>> search(K key, GeoReference<M> reference, BoundingBox boundingBox, RedisGeoCommands.GeoSearchCommandArgs args) {
    return this.search(key, reference, GeoShape.byBox(boundingBox), args);
}

// 根据地理参考、地理形状和参数搜索成员
Flux<GeoResult<RedisGeoCommands.GeoLocation<M>>> search(K key, GeoReference<M> reference, GeoShape geoPredicate, RedisGeoCommands.GeoSearchCommandArgs args);

// 根据圆形范围搜索并存储结果
default Mono<Long> searchAndStore(K key, K destKey, Circle within) {
    return this.searchAndStore(key, destKey, GeoReference.fromCircle(within), GeoShape.byRadius(within.getRadius()), GeoSearchStoreCommandArgs.newGeoSearchStoreArgs());
}

// 根据地理参考和距离搜索并存储结果
default Mono<Long> searchAndStore(K key, K destKey, GeoReference<M> reference, Distance radius) {
    return this.searchAndStore(key, destKey, reference, radius, GeoSearchStoreCommandArgs.newGeoSearchStoreArgs());
}

// 根据地理参考、距离和参数搜索并存储结果
default Mono<Long> searchAndStore(K key, K destKey, GeoReference<M> reference, Distance radius, RedisGeoCommands.GeoSearchStoreCommandArgs args) {
    return this.searchAndStore(key, destKey, reference, GeoShape.byRadius(radius), args);
}

// 根据地理参考和边界框搜索并存储结果
default Mono<Long> searchAndStore(K key, K destKey, GeoReference<M> reference, BoundingBox boundingBox) {
    return this.searchAndStore(key, destKey, reference, boundingBox, GeoSearchStoreCommandArgs.newGeoSearchStoreArgs());
}

// 根据地理参考、边界框和参数搜索并存储结果
default Mono<Long> searchAndStore(K key, K destKey, GeoReference<M> reference, BoundingBox boundingBox, RedisGeoCommands.GeoSearchStoreCommandArgs args) {
    return this.searchAndStore(key, destKey, reference, GeoShape.byBox(boundingBox), args);
}

// 根据地理参考、地理形状和参数搜索并存储结果
Mono<Long> searchAndStore(K key, K destKey, GeoReference<M> reference, GeoShape geoPredicate, RedisGeoCommands.GeoSearchStoreCommandArgs args);

HyperLogLog

// 添加一个或多个元素到集合
Mono<Long> add(K key, V... values); // 将一个或多个元素 "values" 添加到集合 "key"

// 获取多个集合的大小
Mono<Long> size(K... keys); // 获取一个或多个集合的大小

// 计算并集并存储到目标集合
Mono<Boolean> union(K destination, K... sourceKeys); // 将多个集合 "sourceKeys" 的并集存储到目标集合 "destination"

// 删除集合
Mono<Boolean> delete(K key); // 删除集合 "key"

Stream

// 确认处理的消息
default Mono<Long> acknowledge(K key, String group, String... recordIds) {
    return this.acknowledge(key, group, (RecordId[])Arrays.stream(recordIds).map(RecordId::of).toArray((x$0) -> {
        return new RecordId[x$0];
    }));
}

// 确认处理的消息,使用 RecordId
Mono<Long> acknowledge(K key, String group, RecordId... recordIds); // 确认处理的消息,使用 RecordId

// 确认处理的消息,使用 Record 对象
default Mono<Long> acknowledge(String group, Record<K, ?> record) {
    return this.acknowledge(record.getRequiredStream(), group, record.getId());
}

// 添加多个记录
default Flux<RecordId> add(K key, Publisher<? extends Map<? extends HK, ? extends HV>> bodyPublisher) {
    return Flux.from(bodyPublisher).flatMap((it) -> {
        return this.add(key, it);
    });
}

// 添加记录,使用 Map
default Mono<RecordId> add(K key, Map<? extends HK, ? extends HV> content) {
    return this.add(StreamRecords.newRecord().in(key).ofMap(content));
}

// 添加 MapRecord
default Mono<RecordId> add(MapRecord<K, ? extends HK, ? extends HV> record) {
    return this.add((Record)record);
}

// 添加记录
Mono<RecordId> add(Record<K, ?> record); // 添加记录

// 声明消费组
default Flux<MapRecord<K, HK, HV>> claim(K key, String consumerGroup, String newOwner, Duration minIdleTime, RecordId... recordIds) {
    return this.claim(key, consumerGroup, newOwner, XClaimOptions.minIdle(minIdleTime).ids(recordIds));
}

// 声明消费组,使用 XClaimOptions
Flux<MapRecord<K, HK, HV>> claim(K key, String consumerGroup, String newOwner, RedisStreamCommands.XClaimOptions xClaimOptions);

// 删除记录
default Mono<Long> delete(K key, String... recordIds) {
    return this.delete(key, (RecordId[])Arrays.stream(recordIds).map(RecordId::of).toArray((x$0) -> {
        return new RecordId[x$0];
    }));
}

// 删除记录,使用 Record 对象
default Mono<Long> delete(Record<K, ?> record) {
    return this.delete(record.getStream(), record.getId());
}

// 删除记录,使用 RecordId
Mono<Long> delete(K key, RecordId... recordIds); // 删除记录

// 创建消费组
default Mono<String> createGroup(K key, String group) {
    return this.createGroup(key, ReadOffset.latest(), group);
}

// 创建消费组,使用 ReadOffset
Mono<String> createGroup(K key, ReadOffset readOffset, String group); // 创建消费组

// 删除消费者
Mono<String> deleteConsumer(K key, Consumer consumer); // 删除消费者

// 销毁消费组
Mono<String> destroyGroup(K key, String group); // 销毁消费组

// 获取消费者信息
Flux<StreamInfo.XInfoConsumer> consumers(K key, String group); // 获取消费者信息

// 获取消费组信息
Flux<StreamInfo.XInfoGroup> groups(K key); // 获取消费组信息

// 获取流信息
Mono<StreamInfo.XInfoStream> info(K key); // 获取流信息

// 获取待处理消息摘要
@Nullable
Mono<PendingMessagesSummary> pending(K key, String group); // 获取待处理消息摘要

// 获取待处理消息
default Mono<PendingMessages> pending(K key, Consumer consumer) {
    return this.pending(key, consumer, Range.unbounded(), -1L);
}

// 获取待处理消息,使用范围和计数
Mono<PendingMessages> pending(K key, String group, Range<?> range, long count); // 获取待处理消息

// 获取待处理消息,使用消费者、范围和计数
Mono<PendingMessages> pending(K key, Consumer consumer, Range<?> range, long count); // 获取待处理消息

// 获取流的大小
Mono<Long> size(K key); // 获取流的大小

// 获取指定范围内的记录
default Flux<MapRecord<K, HK, HV>> range(K key, Range<String> range) {
    return this.range(key, range, Limit.unlimited());
}

// 获取指定范围内的记录,带限制
Flux<MapRecord<K, HK, HV>> range(K key, Range<String> range, Limit limit); // 获取指定范围内的记录

// 获取指定范围内的记录,使用目标类型
default <V> Flux<ObjectRecord<K, V>> range(Class<V> targetType, K key, Range<String> range) {
    return this.range(targetType, key, range, Limit.unlimited());
}

// 获取指定范围内的记录,使用目标类型和限制
default <V> Flux<ObjectRecord<K, V>> range(Class<V> targetType, K key, Range<String> range, Limit limit) {
    Assert.notNull(targetType, "Target type must not be null");
    return this.range(key, range, limit).map((it) -> {
        return this.map(it, targetType);
    });
}

// 读取流的记录
default Flux<MapRecord<K, HK, HV>> read(StreamOffset<K> stream) {
    Assert.notNull(stream, "StreamOffset must not be null");
    return this.read(StreamReadOptions.empty(), stream);
}

// 读取流的记录,使用目标类型
default <V> Flux<ObjectRecord<K, V>> read(Class<V> targetType, StreamOffset<K> stream) {
    Assert.notNull(stream, "StreamOffset must not be null");
    return this.read(targetType, StreamReadOptions.empty(), stream);
}

// 读取多个流的记录
default Flux<MapRecord<K, HK, HV>> read(StreamOffset<K>... streams) {
    return this.read(StreamReadOptions.empty(), streams);
}

// 读取多个流的记录,使用目标类型
default <V> Flux<ObjectRecord<K, V>> read(Class<V> targetType, StreamOffset<K>... streams) {
    return this.read(targetType, StreamReadOptions.empty(), streams);
}

// 读取流的记录,使用读取选项
Flux<MapRecord<K, HK, HV>> read(StreamReadOptions readOptions, StreamOffset<K>... streams); // 读取流的记录

// 读取流的记录,使用读取选项和目标类型
default <V> Flux<ObjectRecord<K, V>> read(Class<V> targetType, StreamReadOptions readOptions, StreamOffset<K>... streams) {
    Assert.notNull(targetType, "Target type must not be null");
    return this.read(readOptions, streams).map((it) -> {
        return this.map(it, targetType);
    });
}

// 读取流的记录,使用消费者
default Flux<MapRecord<K, HK, HV>> read(Consumer consumer, StreamOffset<K>... streams) {
    return this.read(consumer, StreamReadOptions.empty(), streams);
}

// 读取流的记录,使用消费者和目标类型
default <V> Flux<ObjectRecord<K, V>> read(Class<V> targetType, Consumer consumer, StreamOffset<K>... streams) {
    return this.read(targetType, consumer, StreamReadOptions.empty(), streams);
}

// 读取流的记录,使用消费者和读取选项
Flux<MapRecord<K, HK, HV>> read(Consumer consumer, StreamReadOptions readOptions, StreamOffset<K>... streams); // 读取流的记录

// 读取流的记录,使用消费者、读取选项和目标类型
default <V> Flux<ObjectRecord<K, V>> read(Class<V> targetType, Consumer consumer, StreamReadOptions readOptions, StreamOffset<K>... streams) {
    Assert.notNull(targetType, "Target type must not be null");
    return this.read(consumer, readOptions, streams).map((it) -> {
        return this.map(it, targetType);
    });
}

// 获取反向范围内的记录
default Flux<MapRecord<K, HK, HV>> reverseRange(K key, Range<String> range) {
    return this.reverseRange(key, range, Limit.unlimited());
}

// 获取反向范围内的记录,带限制
Flux<MapRecord<K, HK, HV>> reverseRange(K key, Range<String> range, Limit limit); // 获取反向范围内的记录

// 获取反向范围内的记录,使用目标类型
default <V> Flux<ObjectRecord<K, V>> reverseRange(Class<V> targetType, K key, Range<String> range) {
    return this.reverseRange(targetType, key, range, Limit.unlimited());
}

// 获取反向范围内的记录,使用目标类型和限制
default <V> Flux<ObjectRecord<K, V>> reverseRange(Class<V> targetType, K key, Range<String> range, Limit limit) {
    Assert.notNull(targetType, "Target type must not be null");
    return this.reverseRange(key, range, limit).map((it) -> {
        return this.map(it, targetType);
    });
}

// 修剪流的记录
Mono<Long> trim(K key, long count); // 修剪流的记录

// 修剪流的记录,带近似修剪
Mono<Long> trim(K key, long count, boolean approximateTrimming); // 修剪流的记录,带近似修剪

// 获取 HashMapper
<V> HashMapper<V, HK, HV> getHashMapper(Class<V> targetType); // 获取 HashMapper

// 将 MapRecord 转换为 ObjectRecord
default <V> ObjectRecord<K, V> map(MapRecord<K, HK, HV> record, Class<V> targetType) {
    Assert.notNull(record, "Records must not be null");
    Assert.notNull(targetType, "Target type must not be null");
    return StreamObjectMapper.toObjectRecord(record, this, targetType);
}

// 反序列化记录
MapRecord<K, HK, HV> deserializeRecord(ByteBufferRecord record); // 反序列化记录

最后更新于

这有帮助吗?