Skip to content

Commit

Permalink
Merge pull request #1735 from sazzad16/pull-1531
Browse files Browse the repository at this point in the history
Add missing methods in RedisPipeline and BinaryRedisPipeline
  • Loading branch information
gkorland committed Dec 17, 2018
2 parents 7750a2e + 027f8da commit 95aa6a9
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/main/java/redis/clients/jedis/PipelineBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,19 +181,23 @@ public Response<Boolean> getbit(final byte[] key, final long offset) {
return getResponse(BuilderFactory.BOOLEAN);
}

@Override
public Response<Long> bitpos(final String key, final boolean value) {
return bitpos(key, value, new BitPosParams());
}

@Override
public Response<Long> bitpos(final String key, final boolean value, final BitPosParams params) {
getClient(key).bitpos(key, value, params);
return getResponse(BuilderFactory.LONG);
}

@Override
public Response<Long> bitpos(final byte[] key, final boolean value) {
return bitpos(key, value, new BitPosParams());
}

@Override
public Response<Long> bitpos(final byte[] key, final boolean value, final BitPosParams params) {
getClient(key).bitpos(key, value, params);
return getResponse(BuilderFactory.LONG);
Expand Down Expand Up @@ -619,11 +623,13 @@ public Response<String> set(final byte[] key, final byte[] value) {
return getResponse(BuilderFactory.STRING);
}

@Override
public Response<String> set(final String key, final String value, SetParams params) {
getClient(key).set(key, value, params);
return getResponse(BuilderFactory.STRING);
}

@Override
public Response<String> set(final byte[] key, final byte[] value, SetParams params) {
getClient(key).set(key, value, params);
return getResponse(BuilderFactory.STRING);
Expand Down Expand Up @@ -755,6 +761,7 @@ public Response<String> srandmember(final String key) {
return getResponse(BuilderFactory.STRING);
}

@Override
public Response<List<String>> srandmember(final String key, final int count) {
getClient(key).srandmember(key, count);
return getResponse(BuilderFactory.STRING_LIST);
Expand All @@ -766,6 +773,7 @@ public Response<byte[]> srandmember(final byte[] key) {
return getResponse(BuilderFactory.BYTE_ARRAY);
}

@Override
public Response<List<byte[]>> srandmember(final byte[] key, final int count) {
getClient(key).srandmember(key, count);
return getResponse(BuilderFactory.BYTE_ARRAY_LIST);
Expand Down Expand Up @@ -1021,6 +1029,7 @@ public Response<Set<Tuple>> zrangeByScoreWithScores(final String key, final doub
return getResponse(BuilderFactory.TUPLE_ZSET);
}

@Override
public Response<Set<Tuple>> zrangeByScoreWithScores(final String key, final String min, final String max) {
getClient(key).zrangeByScoreWithScores(key, min, max);
return getResponse(BuilderFactory.TUPLE_ZSET);
Expand All @@ -1045,6 +1054,7 @@ public Response<Set<Tuple>> zrangeByScoreWithScores(final String key, final doub
return getResponse(BuilderFactory.TUPLE_ZSET);
}

@Override
public Response<Set<Tuple>> zrangeByScoreWithScores(final String key, final String min, final String max,
final int offset, final int count) {
getClient(key).zrangeByScoreWithScores(key, min, max, offset, count);
Expand Down Expand Up @@ -1415,31 +1425,37 @@ public Response<String> migrate(final String host, final int port,
return getResponse(BuilderFactory.STRING);
}

@Override
public Response<Long> objectRefcount(final String key) {
getClient(key).objectRefcount(key);
return getResponse(BuilderFactory.LONG);
}

@Override
public Response<Long> objectRefcount(final byte[] key) {
getClient(key).objectRefcount(key);
return getResponse(BuilderFactory.LONG);
}

@Override
public Response<String> objectEncoding(final String key) {
getClient(key).objectEncoding(key);
return getResponse(BuilderFactory.STRING);
}

@Override
public Response<byte[]> objectEncoding(final byte[] key) {
getClient(key).objectEncoding(key);
return getResponse(BuilderFactory.BYTE_ARRAY);
}

@Override
public Response<Long> objectIdletime(final String key) {
getClient(key).objectIdletime(key);
return getResponse(BuilderFactory.LONG);
}

@Override
public Response<Long> objectIdletime(final byte[] key) {
getClient(key).objectIdletime(key);
return getResponse(BuilderFactory.LONG);
Expand Down Expand Up @@ -1469,11 +1485,13 @@ public Response<Long> pexpireAt(final byte[] key, final long millisecondsTimesta
return getResponse(BuilderFactory.LONG);
}

@Override
public Response<Long> pttl(final String key) {
getClient(key).pttl(key);
return getResponse(BuilderFactory.LONG);
}

@Override
public Response<Long> pttl(final byte[] key) {
getClient(key).pttl(key);
return getResponse(BuilderFactory.LONG);
Expand Down Expand Up @@ -1503,31 +1521,37 @@ public Response<String> restoreReplace(final byte[] key, final int ttl, final by
return getResponse(BuilderFactory.STRING);
}

@Override
public Response<Double> incrByFloat(final String key, final double increment) {
getClient(key).incrByFloat(key, increment);
return getResponse(BuilderFactory.DOUBLE);
}

@Override
public Response<Double> incrByFloat(final byte[] key, final double increment) {
getClient(key).incrByFloat(key, increment);
return getResponse(BuilderFactory.DOUBLE);
}

@Override
public Response<String> psetex(final String key, final long milliseconds, final String value) {
getClient(key).psetex(key, milliseconds, value);
return getResponse(BuilderFactory.STRING);
}

@Override
public Response<String> psetex(final byte[] key, final long milliseconds, final byte[] value) {
getClient(key).psetex(key, milliseconds, value);
return getResponse(BuilderFactory.STRING);
}

@Override
public Response<Double> hincrByFloat(final String key, final String field, final double increment) {
getClient(key).hincrByFloat(key, field, increment);
return getResponse(BuilderFactory.DOUBLE);
}

@Override
public Response<Double> hincrByFloat(final byte[] key, final byte[] field, final double increment) {
getClient(key).hincrByFloat(key, field, increment);
return getResponse(BuilderFactory.DOUBLE);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package redis.clients.jedis.commands;

import redis.clients.jedis.BitPosParams;
import redis.clients.jedis.GeoCoordinate;
import redis.clients.jedis.GeoRadiusResponse;
import redis.clients.jedis.GeoUnit;
Expand All @@ -8,6 +9,7 @@
import redis.clients.jedis.SortingParams;
import redis.clients.jedis.Tuple;
import redis.clients.jedis.params.GeoRadiusParam;
import redis.clients.jedis.params.SetParams;
import redis.clients.jedis.params.ZAddParams;
import redis.clients.jedis.params.ZIncrByParams;

Expand Down Expand Up @@ -301,4 +303,24 @@ Response<List<GeoRadiusResponse>> georadiusByMemberReadonly(byte[] key, byte[] m
Response<List<Long>> bitfield(byte[] key, byte[]... elements);

Response<Long> hstrlen(byte[] key, byte[] field);

Response<Long> bitpos(byte[] key, boolean value);

Response<Long> bitpos(byte[] key, boolean value, BitPosParams params);

Response<String> set(byte[] key, byte[] value, SetParams params);

Response<List<byte[]>> srandmember(byte[] key, int count);

Response<Long> objectRefcount(byte[] key);

Response<byte[]> objectEncoding(byte[] key);

Response<Long> objectIdletime(byte[] key);

Response<Double> incrByFloat(byte[] key, double increment);

Response<String> psetex(byte[] key, long milliseconds, byte[] value);

Response<Double> hincrByFloat(byte[] key, byte[] field, double increment);
}
27 changes: 27 additions & 0 deletions src/main/java/redis/clients/jedis/commands/RedisPipeline.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package redis.clients.jedis.commands;

import redis.clients.jedis.BitPosParams;
import redis.clients.jedis.GeoCoordinate;
import redis.clients.jedis.GeoRadiusResponse;
import redis.clients.jedis.GeoUnit;
Expand All @@ -8,6 +9,7 @@
import redis.clients.jedis.SortingParams;
import redis.clients.jedis.Tuple;
import redis.clients.jedis.params.GeoRadiusParam;
import redis.clients.jedis.params.SetParams;
import redis.clients.jedis.params.ZAddParams;
import redis.clients.jedis.params.ZIncrByParams;

Expand Down Expand Up @@ -294,4 +296,29 @@ Response<List<GeoRadiusResponse>> georadiusByMember(String key, String member, d

Response<List<GeoRadiusResponse>> georadiusByMemberReadonly(String key, String member, double radius,
GeoUnit unit, GeoRadiusParam param);

Response<Long> bitpos(String key, boolean value);

Response<Long> bitpos(String key, boolean value, BitPosParams params);

Response<String> set(String key, String value, SetParams params);

Response<List<String>> srandmember(String key, int count);

Response<Set<Tuple>> zrangeByScoreWithScores(String key, String min, String max);

Response<Set<Tuple>> zrangeByScoreWithScores(String key, String min, String max, int offset,
int count);

Response<Long> objectRefcount(String key);

Response<String> objectEncoding(String key);

Response<Long> objectIdletime(String key);

Response<Double> incrByFloat(String key, double increment);

Response<String> psetex(String key, long milliseconds, String value);

Response<Double> hincrByFloat(String key, String field, double increment);
}

0 comments on commit 95aa6a9

Please sign in to comment.