1
1
package redis .clients .jedis ;
2
2
3
- import static redis .clients .jedis .Protocol .toByteArray ;
4
- import static redis .clients .jedis .Protocol .Command .*;
5
- import static redis .clients .jedis .Protocol .Keyword .ENCODING ;
6
- import static redis .clients .jedis .Protocol .Keyword .IDLETIME ;
7
- import static redis .clients .jedis .Protocol .Keyword .LEN ;
8
- import static redis .clients .jedis .Protocol .Keyword .LIMIT ;
9
- import static redis .clients .jedis .Protocol .Keyword .NO ;
10
- import static redis .clients .jedis .Protocol .Keyword .ONE ;
11
- import static redis .clients .jedis .Protocol .Keyword .REFCOUNT ;
12
- import static redis .clients .jedis .Protocol .Keyword .RESET ;
13
- import static redis .clients .jedis .Protocol .Keyword .STORE ;
14
- import static redis .clients .jedis .Protocol .Keyword .WITHSCORES ;
3
+ import redis .clients .jedis .Protocol .Command ;
4
+ import redis .clients .jedis .Protocol .Keyword ;
5
+ import redis .clients .util .SafeEncoder ;
15
6
16
7
import java .util .ArrayList ;
17
8
import java .util .List ;
18
9
import java .util .Map ;
19
10
import java .util .Map .Entry ;
20
11
21
- import redis .clients .jedis .Protocol .Command ;
22
- import redis .clients .jedis .Protocol .Keyword ;
23
- import redis .clients .util .SafeEncoder ;
12
+ import static redis .clients .jedis .Protocol .Command .*;
13
+ import static redis .clients .jedis .Protocol .Command .EXISTS ;
14
+ import static redis .clients .jedis .Protocol .Command .PSUBSCRIBE ;
15
+ import static redis .clients .jedis .Protocol .Command .PUNSUBSCRIBE ;
16
+ import static redis .clients .jedis .Protocol .Command .SUBSCRIBE ;
17
+ import static redis .clients .jedis .Protocol .Command .UNSUBSCRIBE ;
18
+ import static redis .clients .jedis .Protocol .Keyword .*;
19
+ import static redis .clients .jedis .Protocol .toByteArray ;
24
20
25
21
public class BinaryClient extends Connection {
26
22
public enum LIST_POSITION {
@@ -203,6 +199,10 @@ public void incrBy(final byte[] key, final long integer) {
203
199
sendCommand (INCRBY , key , toByteArray (integer ));
204
200
}
205
201
202
+ public void incrByFloat (final byte [] key , final double value ) {
203
+ sendCommand (INCRBYFLOAT , key , toByteArray (value ));
204
+ }
205
+
206
206
public void incr (final byte [] key ) {
207
207
sendCommand (INCR , key );
208
208
}
@@ -320,7 +320,7 @@ public void rpoplpush(final byte[] srckey, final byte[] dstkey) {
320
320
public void sadd (final byte [] key , final byte []... members ) {
321
321
sendCommand (SADD , joinParameters (key , members ));
322
322
}
323
-
323
+
324
324
public void smembers (final byte [] key ) {
325
325
sendCommand (SMEMBERS , key );
326
326
}
@@ -929,7 +929,15 @@ public void setbit(byte[] key, long offset, boolean value) {
929
929
public void getbit (byte [] key , long offset ) {
930
930
sendCommand (GETBIT , key , toByteArray (offset ));
931
931
}
932
-
932
+
933
+ public void bitpos (final byte [] key , final boolean value , final BitPosParams params ) {
934
+ final List <byte []> args = new ArrayList <byte []>();
935
+ args .add (key );
936
+ args .add (toByteArray (value ));
937
+ args .addAll (params .getParams ());
938
+ sendCommand (BITPOS , args .toArray (new byte [args .size ()][]));
939
+ }
940
+
933
941
public void setrange (byte [] key , long offset , byte [] value ) {
934
942
sendCommand (SETRANGE , key , toByteArray (offset ), value );
935
943
}
@@ -1091,7 +1099,12 @@ public void restore(final byte[] key, final int ttl,
1091
1099
sendCommand (RESTORE , key , toByteArray (ttl ), serializedValue );
1092
1100
}
1093
1101
1102
+ @ Deprecated
1094
1103
public void pexpire (final byte [] key , final int milliseconds ) {
1104
+ pexpire (key , (long ) milliseconds );
1105
+ }
1106
+
1107
+ public void pexpire (final byte [] key , final long milliseconds ) {
1095
1108
sendCommand (PEXPIRE , key , toByteArray (milliseconds ));
1096
1109
}
1097
1110
@@ -1103,10 +1116,6 @@ public void pttl(final byte[] key) {
1103
1116
sendCommand (PTTL , key );
1104
1117
}
1105
1118
1106
- public void incrByFloat (final byte [] key , final double increment ) {
1107
- sendCommand (INCRBYFLOAT , key , toByteArray (increment ));
1108
- }
1109
-
1110
1119
public void psetex (final byte [] key , final int milliseconds ,
1111
1120
final byte [] value ) {
1112
1121
sendCommand (PSETEX , key , toByteArray (milliseconds ), value );
@@ -1253,4 +1262,20 @@ public void cluster(final byte[]... args) {
1253
1262
public void asking () {
1254
1263
sendCommand (Command .ASKING );
1255
1264
}
1265
+
1266
+ public void pfadd (final byte [] key , final byte []... elements ) {
1267
+ sendCommand (PFADD , joinParameters (key , elements ));
1268
+ }
1269
+
1270
+ public void pfcount (final byte [] key ) {
1271
+ sendCommand (PFCOUNT , key );
1272
+ }
1273
+
1274
+ public void pfcount (final byte []...keys ) {
1275
+ sendCommand (PFCOUNT , keys );
1276
+ }
1277
+
1278
+ public void pfmerge (final byte [] destkey , final byte []... sourcekeys ) {
1279
+ sendCommand (PFMERGE , joinParameters (destkey , sourcekeys ));
1280
+ }
1256
1281
}
0 commit comments