Ejemplo n.º 1
0
 @SuppressWarnings("unchecked")
 public Future<Long> zadd(K key, Object... scoresAndValues) {
   CommandArgs<K, V> args = new CommandArgs<K, V>(codec).addKey(key);
   for (int i = 0; i < scoresAndValues.length; i += 2) {
     args.add((Double) scoresAndValues[i]);
     args.addValue((V) scoresAndValues[i + 1]);
   }
   return dispatch(ZADD, new IntegerOutput<K, V>(codec), args);
 }
Ejemplo n.º 2
0
 public Future<Long> bitopAnd(K destination, K... keys) {
   CommandArgs<K, V> args = new CommandArgs<K, V>(codec);
   args.add(AND).addKey(destination).addKeys(keys);
   return dispatch(BITOP, new IntegerOutput<K, V>(codec), args);
 }
Ejemplo n.º 3
0
 public Future<Long> zunionstore(K destination, ZStoreArgs storeArgs, K... keys) {
   CommandArgs<K, V> args = new CommandArgs<K, V>(codec);
   args.addKey(destination).add(keys.length).addKeys(keys);
   storeArgs.build(args);
   return dispatch(ZUNIONSTORE, new IntegerOutput<K, V>(codec), args);
 }
Ejemplo n.º 4
0
 public Future<Long> bitcount(K key, long start, long end) {
   CommandArgs<K, V> args = new CommandArgs<K, V>(codec);
   args.addKey(key).add(start).add(end);
   return dispatch(BITCOUNT, new IntegerOutput<K, V>(codec), args);
 }
Ejemplo n.º 5
0
 public Future<List<ScoredValue<V>>> zrevrangebyscoreWithScores(
     K key, String max, String min, long offset, long count) {
   CommandArgs<K, V> args = new CommandArgs<K, V>(codec);
   args.addKey(key).add(max).add(min).add(WITHSCORES).add(LIMIT).add(offset).add(count);
   return dispatch(ZREVRANGEBYSCORE, new ScoredValueListOutput<K, V>(codec), args);
 }
Ejemplo n.º 6
0
 public Future<List<ScoredValue<V>>> zrevrangeWithScores(K key, long start, long stop) {
   CommandArgs<K, V> args = new CommandArgs<K, V>(codec);
   args.addKey(key).add(start).add(stop).add(WITHSCORES);
   return dispatch(ZREVRANGE, new ScoredValueListOutput<K, V>(codec), args);
 }
Ejemplo n.º 7
0
 public Future<List<ScoredValue<V>>> zrangebyscoreWithScores(K key, String min, String max) {
   CommandArgs<K, V> args = new CommandArgs<K, V>(codec);
   args.addKey(key).add(min).add(max).add(WITHSCORES);
   return dispatch(ZRANGEBYSCORE, new ScoredValueListOutput<K, V>(codec), args);
 }
Ejemplo n.º 8
0
 public Future<List<V>> zrangebyscore(K key, String min, String max, long offset, long count) {
   CommandArgs<K, V> args = new CommandArgs<K, V>(codec);
   args.addKey(key).add(min).add(max).add(LIMIT).add(offset).add(count);
   return dispatch(ZRANGEBYSCORE, new ValueListOutput<K, V>(codec), args);
 }
Ejemplo n.º 9
0
 public Future<List<Boolean>> scriptExists(String... digests) {
   CommandArgs<K, V> args = new CommandArgs<K, V>(codec).add(EXISTS);
   for (String sha : digests) args.add(sha);
   return dispatch(SCRIPT, new BooleanListOutput<K, V>(codec), args);
 }
Ejemplo n.º 10
0
 public void shutdown(boolean save) {
   CommandArgs<K, V> args = new CommandArgs<K, V>(codec);
   dispatch(SHUTDOWN, new StatusOutput<K, V>(codec), save ? args.add(SAVE) : args.add(NOSAVE));
 }
Ejemplo n.º 11
0
 public Future<String> migrate(String host, int port, K key, int db, long timeout) {
   CommandArgs<K, V> args = new CommandArgs<K, V>(codec);
   args.add(host).add(port).addKey(key).add(db).add(timeout);
   return dispatch(MIGRATE, new StatusOutput<K, V>(codec), args);
 }
Ejemplo n.º 12
0
 public Future<Long> linsert(K key, boolean before, V pivot, V value) {
   CommandArgs<K, V> args = new CommandArgs<K, V>(codec);
   args.addKey(key).add(before ? BEFORE : AFTER).addValue(pivot).addValue(value);
   return dispatch(LINSERT, new IntegerOutput<K, V>(codec), args);
 }
Ejemplo n.º 13
0
 public <T> Future<T> evalsha(String digest, ScriptOutputType type, K[] keys, V... values) {
   CommandArgs<K, V> args = new CommandArgs<K, V>(codec);
   args.add(digest).add(keys.length).addKeys(keys).addValues(values);
   CommandOutput<K, V, T> output = newScriptOutput(codec, type);
   return dispatch(EVALSHA, output, args);
 }
Ejemplo n.º 14
0
 public Future<V> brpoplpush(long timeout, K source, K destination) {
   CommandArgs<K, V> args = new CommandArgs<K, V>(codec);
   args.addKey(source).addKey(destination).add(timeout);
   return dispatch(BRPOPLPUSH, new ValueOutput<K, V>(codec), args);
 }
Ejemplo n.º 15
0
 public Future<Long> bitopNot(K destination, K source) {
   CommandArgs<K, V> args = new CommandArgs<K, V>(codec);
   args.add(NOT).addKey(destination).addKey(source);
   return dispatch(BITOP, new IntegerOutput<K, V>(codec), args);
 }