SortedSetBinaryCommands.java

package redis.clients.jedis.commands;

import java.util.List;
import java.util.Map;

import redis.clients.jedis.args.SortedSetOption;
import redis.clients.jedis.params.*;
import redis.clients.jedis.resps.ScanResult;
import redis.clients.jedis.resps.Tuple;
import redis.clients.jedis.util.KeyValue;

public interface SortedSetBinaryCommands {

  long zadd(byte[] key, double score, byte[] member);

  long zadd(byte[] key, double score, byte[] member, ZAddParams params);

  long zadd(byte[] key, Map<byte[], Double> scoreMembers);

  long zadd(byte[] key, Map<byte[], Double> scoreMembers, ZAddParams params);

  Double zaddIncr(byte[] key, double score, byte[] member, ZAddParams params);

  long zrem(byte[] key, byte[]... members);

  double zincrby(byte[] key, double increment, byte[] member);

  Double zincrby(byte[] key, double increment, byte[] member, ZIncrByParams params);

  Long zrank(byte[] key, byte[] member);

  Long zrevrank(byte[] key, byte[] member);

  KeyValue<Long, Double> zrankWithScore(byte[] key, byte[] member);

  KeyValue<Long, Double> zrevrankWithScore(byte[] key, byte[] member);

  List<byte[]> zrange(byte[] key, long start, long stop);

  /**
   * @deprecated Use {@link SortedSetBinaryCommands#zrange(byte[], ZRangeParams)} with {@link ZRangeParams#rev()}.
   * Deprecated in Jedis 7.3.0. Mirrors Redis deprecation since 6.2.0.
   */
  @Deprecated
  List<byte[]> zrevrange(byte[] key, long start, long stop);

  List<Tuple> zrangeWithScores(byte[] key, long start, long stop);

  /**
   * @deprecated Use {@link SortedSetBinaryCommands#zrangeWithScores(byte[], ZRangeParams)} with {@link ZRangeParams#rev()}.
   * Deprecated in Jedis 7.3.0. Mirrors Redis deprecation since 6.2.0.
   */
  @Deprecated
  List<Tuple> zrevrangeWithScores(byte[] key, long start, long stop);

  List<byte[]> zrange(byte[] key, ZRangeParams zRangeParams);

  List<Tuple> zrangeWithScores(byte[] key, ZRangeParams zRangeParams);

  long zrangestore(byte[] dest, byte[] src, ZRangeParams zRangeParams);

  byte[] zrandmember(byte[] key);

  List<byte[]> zrandmember(byte[] key, long count);

  List<Tuple> zrandmemberWithScores(byte[] key, long count);

  long zcard(byte[] key);

  Double zscore(byte[] key, byte[] member);

  List<Double> zmscore(byte[] key, byte[]... members);

  Tuple zpopmax(byte[] key);

  List<Tuple> zpopmax(byte[] key, int count);

  Tuple zpopmin(byte[] key);

  List<Tuple> zpopmin(byte[] key, int count);

  long zcount(byte[] key, double min, double max);

  long zcount(byte[] key, byte[] min, byte[] max);

  /**
   * @deprecated Use {@link SortedSetBinaryCommands#zrange(byte[], ZRangeParams)} with {@link ZRangeParams#zrangeByScoreParams(double, double)}.
   * Deprecated in Jedis 7.3.0. Mirrors Redis deprecation since 6.2.0.
   */
  @Deprecated
  List<byte[]> zrangeByScore(byte[] key, double min, double max);

  /**
   * @deprecated Use {@link SortedSetBinaryCommands#zrange(byte[], ZRangeParams)} with {@link ZRangeParams#zrangeByScoreParams(double, double)}.
   * Deprecated in Jedis 7.3.0. Mirrors Redis deprecation since 6.2.0.
   */
  @Deprecated
  List<byte[]> zrangeByScore(byte[] key, byte[] min, byte[] max);

  /**
   * @deprecated Use {@link SortedSetBinaryCommands#zrange(byte[], ZRangeParams)} with {@link ZRangeParams#zrangeByScoreParams(double, double)} and {@link ZRangeParams#rev()}.
   * Deprecated in Jedis 7.3.0. Mirrors Redis deprecation since 6.2.0.
   */
  @Deprecated
  List<byte[]> zrevrangeByScore(byte[] key, double max, double min);

  /**
   * @deprecated Use {@link SortedSetBinaryCommands#zrange(byte[], ZRangeParams)} with {@link ZRangeParams#zrangeByScoreParams(double, double)}.
   * Deprecated in Jedis 7.3.0. Mirrors Redis deprecation since 6.2.0.
   */
  @Deprecated
  List<byte[]> zrangeByScore(byte[] key, double min, double max, int offset, int count);

  /**
   * @deprecated Use {@link SortedSetBinaryCommands#zrange(byte[], ZRangeParams)} with {@link ZRangeParams#zrangeByScoreParams(double, double)} and {@link ZRangeParams#rev()}.
   * Deprecated in Jedis 7.3.0. Mirrors Redis deprecation since 6.2.0.
   */
  @Deprecated
  List<byte[]> zrevrangeByScore(byte[] key, byte[] max, byte[] min);

  /**
   * @deprecated Use {@link SortedSetBinaryCommands#zrange(byte[], ZRangeParams)} with {@link ZRangeParams#zrangeByScoreParams(double, double)}.
   * Deprecated in Jedis 7.3.0. Mirrors Redis deprecation since 6.2.0.
   */
  @Deprecated
  List<byte[]> zrangeByScore(byte[] key, byte[] min, byte[] max, int offset, int count);

  /**
   * @deprecated Use {@link SortedSetBinaryCommands#zrange(byte[], ZRangeParams)} with {@link ZRangeParams#zrangeByScoreParams(double, double)} and {@link ZRangeParams#rev()}.
   * Deprecated in Jedis 7.3.0. Mirrors Redis deprecation since 6.2.0.
   */
  @Deprecated
  List<byte[]> zrevrangeByScore(byte[] key, double max, double min, int offset, int count);

  /**
   * @deprecated Use {@link SortedSetBinaryCommands#zrangeWithScores(byte[], ZRangeParams)} with {@link ZRangeParams#zrangeByScoreParams(double, double)}.
   * Deprecated in Jedis 7.3.0. Mirrors Redis deprecation since 6.2.0.
   */
  @Deprecated
  List<Tuple> zrangeByScoreWithScores(byte[] key, double min, double max);

  /**
   * @deprecated Use {@link SortedSetBinaryCommands#zrangeWithScores(byte[], ZRangeParams)} with {@link ZRangeParams#zrangeByScoreParams(double, double)} and {@link ZRangeParams#rev()}.
   * Deprecated in Jedis 7.3.0. Mirrors Redis deprecation since 6.2.0.
   */
  @Deprecated
  List<Tuple> zrevrangeByScoreWithScores(byte[] key, double max, double min);

  /**
   * @deprecated Use {@link SortedSetBinaryCommands#zrangeWithScores(byte[], ZRangeParams)} with {@link ZRangeParams#zrangeByScoreParams(double, double)}.
   * Deprecated in Jedis 7.3.0. Mirrors Redis deprecation since 6.2.0.
   */
  @Deprecated
  List<Tuple> zrangeByScoreWithScores(byte[] key, double min, double max, int offset, int count);

  /**
   * @deprecated Use {@link SortedSetBinaryCommands#zrange(byte[], ZRangeParams)} with {@link ZRangeParams#zrangeByScoreParams(double, double)} and {@link ZRangeParams#rev()}.
   * Deprecated in Jedis 7.3.0. Mirrors Redis deprecation since 6.2.0.
   */
  @Deprecated
  List<byte[]> zrevrangeByScore(byte[] key, byte[] max, byte[] min, int offset, int count);

  /**
   * @deprecated Use {@link SortedSetBinaryCommands#zrangeWithScores(byte[], ZRangeParams)} with {@link ZRangeParams#zrangeByScoreParams(double, double)}.
   * Deprecated in Jedis 7.3.0. Mirrors Redis deprecation since 6.2.0.
   */
  @Deprecated
  List<Tuple> zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max);

  /**
   * @deprecated Use {@link SortedSetBinaryCommands#zrangeWithScores(byte[], ZRangeParams)} with {@link ZRangeParams#zrangeByScoreParams(double, double)} and {@link ZRangeParams#rev()}.
   * Deprecated in Jedis 7.3.0. Mirrors Redis deprecation since 6.2.0.
   */
  @Deprecated
  List<Tuple> zrevrangeByScoreWithScores(byte[] key, byte[] max, byte[] min);

  /**
   * @deprecated Use {@link SortedSetBinaryCommands#zrangeWithScores(byte[], ZRangeParams)} with {@link ZRangeParams#zrangeByScoreParams(double, double)}.
   * Deprecated in Jedis 7.3.0. Mirrors Redis deprecation since 6.2.0.
   */
  @Deprecated
  List<Tuple> zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max, int offset, int count);

  /**
   * @deprecated Use {@link SortedSetBinaryCommands#zrangeWithScores(byte[], ZRangeParams)} with {@link ZRangeParams#zrangeByScoreParams(double, double)} and {@link ZRangeParams#rev()}.
   * Deprecated in Jedis 7.3.0. Mirrors Redis deprecation since 6.2.0.
   */
  @Deprecated
  List<Tuple> zrevrangeByScoreWithScores(byte[] key, double max, double min, int offset, int count);

  /**
   * @deprecated Use {@link SortedSetBinaryCommands#zrangeWithScores(byte[], ZRangeParams)} with {@link ZRangeParams#zrangeByScoreParams(double, double)} and {@link ZRangeParams#rev()}.
   * Deprecated in Jedis 7.3.0. Mirrors Redis deprecation since 6.2.0.
   */
  @Deprecated
  List<Tuple> zrevrangeByScoreWithScores(byte[] key, byte[] max, byte[] min, int offset, int count);

  long zremrangeByRank(byte[] key, long start, long stop);

  long zremrangeByScore(byte[] key, double min, double max);

  long zremrangeByScore(byte[] key, byte[] min, byte[] max);

  long zlexcount(byte[] key, byte[] min, byte[] max);

  /**
   * @deprecated Use {@link SortedSetBinaryCommands#zrange(byte[], ZRangeParams)} with {@link ZRangeParams#zrangeByLexParams(byte[], byte[])}.
   * Deprecated in Jedis 7.3.0. Mirrors Redis deprecation since 6.2.0.
   */
  @Deprecated
  List<byte[]> zrangeByLex(byte[] key, byte[] min, byte[] max);

  /**
   * @deprecated Use {@link SortedSetBinaryCommands#zrange(byte[], ZRangeParams)} with {@link ZRangeParams#zrangeByLexParams(byte[], byte[])}.
   * Deprecated in Jedis 7.3.0. Mirrors Redis deprecation since 6.2.0.
   */
  @Deprecated
  List<byte[]> zrangeByLex(byte[] key, byte[] min, byte[] max, int offset, int count);

  /**
   * @deprecated Use {@link SortedSetBinaryCommands#zrange(byte[], ZRangeParams)} with {@link ZRangeParams#zrangeByLexParams(byte[], byte[])} and {@link ZRangeParams#rev()}.
   * Deprecated in Jedis 7.3.0. Mirrors Redis deprecation since 6.2.0.
   */
  @Deprecated
  List<byte[]> zrevrangeByLex(byte[] key, byte[] max, byte[] min);

  /**
   * @deprecated Use {@link SortedSetBinaryCommands#zrange(byte[], ZRangeParams)} with {@link ZRangeParams#zrangeByLexParams(byte[], byte[])} and {@link ZRangeParams#rev()}.
   * Deprecated in Jedis 7.3.0. Mirrors Redis deprecation since 6.2.0.
   */
  @Deprecated
  List<byte[]> zrevrangeByLex(byte[] key, byte[] max, byte[] min, int offset, int count);

  long zremrangeByLex(byte[] key, byte[] min, byte[] max);

  default ScanResult<Tuple> zscan(byte[] key, byte[] cursor) {
    return zscan(key, cursor, new ScanParams());
  }

  ScanResult<Tuple> zscan(byte[] key, byte[] cursor, ScanParams params);

  KeyValue<byte[], Tuple> bzpopmax(double timeout, byte[]... keys);

  KeyValue<byte[], Tuple> bzpopmin(double timeout, byte[]... keys);

  List<byte[]> zdiff(byte[]... keys);

  List<Tuple> zdiffWithScores(byte[]... keys);

  /**
   * @deprecated Use {@link #zdiffstore(byte[], byte[][])}.
   */
  @Deprecated
  long zdiffStore(byte[] dstkey, byte[]... keys);

  long zdiffstore(byte[] dstkey, byte[]... keys);

  List<byte[]> zinter(ZParams params, byte[]... keys);

  List<Tuple> zinterWithScores(ZParams params, byte[]... keys);

  long zinterstore(byte[] dstkey, byte[]... sets);

  long zinterstore(byte[] dstkey, ZParams params, byte[]... sets);

  /**
   * Similar to {@link #zinter(ZParams, byte[][]) ZINTER}, but instead of returning the result set,
   * it returns just the cardinality of the result.
   * <p>
   * Time complexity O(N*K) worst case with N being the smallest input sorted set, K
   * being the number of input sorted sets
   * @see #zinter(ZParams, byte[][])
   * @param keys group of sets
   * @return The number of elements in the resulting intersection
   */
  long zintercard(byte[]... keys);

  /**
   * Similar to {@link #zinter(ZParams, byte[][]) ZINTER}, but instead of returning the result set,
   * it returns just the cardinality of the result.
   * <p>
   * Time complexity O(N*K) worst case with N being the smallest input sorted set, K
   * being the number of input sorted sets
   * @see #zinter(ZParams, byte[][])
   * @param limit If the intersection cardinality reaches limit partway through the computation,
   *              the algorithm will exit and yield limit as the cardinality
   * @param keys group of sets
   * @return The number of elements in the resulting intersection
   */
  long zintercard(long limit, byte[]... keys);

  List<byte[]> zunion(ZParams params, byte[]... keys);

  List<Tuple> zunionWithScores(ZParams params, byte[]... keys);

  long zunionstore(byte[] dstkey, byte[]... sets);

  long zunionstore(byte[] dstkey, ZParams params, byte[]... sets);

  KeyValue<byte[], List<Tuple>> zmpop(SortedSetOption option, byte[]... keys);

  KeyValue<byte[], List<Tuple>> zmpop(SortedSetOption option, int count, byte[]... keys);

  KeyValue<byte[], List<Tuple>> bzmpop(double timeout, SortedSetOption option, byte[]... keys);

  KeyValue<byte[], List<Tuple>> bzmpop(double timeout, SortedSetOption option, int count, byte[]... keys);

  /**
   * Binary variant of {@link SortedSetCommands#zmove(String, String, SortedSetOption)}.
   * @see SortedSetCommands#zmove(String, String, SortedSetOption)
   * @since 8.1
   */
  List<Tuple> zmove(byte[] srcKey, byte[] dstKey, SortedSetOption end);

  /**
   * Binary variant of {@link SortedSetCommands#zmove(String, String, SortedSetOption, long)}.
   * @see SortedSetCommands#zmove(String, String, SortedSetOption, long)
   * @since 8.1
   */
  List<Tuple> zmove(byte[] srcKey, byte[] dstKey, SortedSetOption end, long count);

  /**
   * Binary variant of {@link SortedSetCommands#zmoveByScore(String, String, double, double)}.
   * @see SortedSetCommands#zmoveByScore(String, String, double, double)
   * @since 8.1
   */
  List<Tuple> zmoveByScore(byte[] srcKey, byte[] dstKey, double min, double max);

  /**
   * Binary variant of {@link SortedSetCommands#zmoveByScore(String, String, double, double, long)}.
   * @see SortedSetCommands#zmoveByScore(String, String, double, double, long)
   * @since 8.1
   */
  List<Tuple> zmoveByScore(byte[] srcKey, byte[] dstKey, double min, double max, long count);

  /**
   * Binary variant of {@link SortedSetCommands#zmoveByScore(String, String, String, String)}.
   * @see SortedSetCommands#zmoveByScore(String, String, String, String)
   * @since 8.1
   */
  List<Tuple> zmoveByScore(byte[] srcKey, byte[] dstKey, byte[] min, byte[] max);

  /**
   * Binary variant of {@link SortedSetCommands#zmoveByScore(String, String, String, String, long)}.
   * @see SortedSetCommands#zmoveByScore(String, String, String, String, long)
   * @since 8.1
   */
  List<Tuple> zmoveByScore(byte[] srcKey, byte[] dstKey, byte[] min, byte[] max, long count);

  /**
   * Binary variant of {@link SortedSetCommands#bzmove(String, String, SortedSetOption, double)}.
   * @see SortedSetCommands#bzmove(String, String, SortedSetOption, double)
   * @since 8.1
   */
  List<Tuple> bzmove(byte[] srcKey, byte[] dstKey, SortedSetOption end, double timeout);

  /**
   * Binary variant of {@link SortedSetCommands#bzmove(String, String, SortedSetOption, double, long)}.
   * @see SortedSetCommands#bzmove(String, String, SortedSetOption, double, long)
   * @since 8.1
   */
  List<Tuple> bzmove(byte[] srcKey, byte[] dstKey, SortedSetOption end, double timeout, long count);

  /**
   * Binary variant of {@link SortedSetCommands#zmovemember(String, String, String)}.
   * @see SortedSetCommands#zmovemember(String, String, String)
   * @since 8.1
   */
  Tuple zmovemember(byte[] srcKey, byte[] dstKey, byte[] member);

  /**
   * Binary variant of {@link SortedSetCommands#zmovemember(String, String, String...)}.
   * @see SortedSetCommands#zmovemember(String, String, String...)
   * @since 8.1
   */
  List<Tuple> zmovemember(byte[] srcKey, byte[] dstKey, byte[]... members);

  /**
   * Binary variant of {@link SortedSetCommands#zmovemember(String, String, ZMoveMemberParams, String)}.
   * @see SortedSetCommands#zmovemember(String, String, ZMoveMemberParams, String)
   * @since 8.1
   */
  Tuple zmovemember(byte[] srcKey, byte[] dstKey, ZMoveMemberParams params, byte[] member);

  /**
   * Binary variant of {@link SortedSetCommands#zmovemember(String, String, ZMoveMemberParams, String...)}.
   * @see SortedSetCommands#zmovemember(String, String, ZMoveMemberParams, String...)
   * @since 8.1
   */
  List<Tuple> zmovemember(byte[] srcKey, byte[] dstKey, ZMoveMemberParams params, byte[]... members);
}