Skip to content

Commit 6f8d46a

Browse files
committed
Merge branch 'master' into implements-closeable-to-pooled-jedis-shardedjedis
Conflicts: src/main/java/redis/clients/jedis/Jedis.java src/main/java/redis/clients/jedis/JedisSentinelPool.java src/main/java/redis/clients/jedis/ShardedJedis.java src/test/java/redis/clients/jedis/tests/JedisPoolTest.java
2 parents 670e019 + 0a8aa7a commit 6f8d46a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+2187
-208
lines changed

Makefile

+53
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,42 @@ cluster-enabled yes
153153
cluster-config-file /tmp/redis_cluster_node3.conf
154154
endef
155155

156+
define REDIS_CLUSTER_NODE4_CONF
157+
daemonize yes
158+
port 7382
159+
cluster-node-timeout 50
160+
pidfile /tmp/redis_cluster_node4.pid
161+
logfile /tmp/redis_cluster_node4.log
162+
save ""
163+
appendonly no
164+
cluster-enabled yes
165+
cluster-config-file /tmp/redis_cluster_node4.conf
166+
endef
167+
168+
define REDIS_CLUSTER_NODE5_CONF
169+
daemonize yes
170+
port 7383
171+
cluster-node-timeout 5000
172+
pidfile /tmp/redis_cluster_node5.pid
173+
logfile /tmp/redis_cluster_node5.log
174+
save ""
175+
appendonly no
176+
cluster-enabled yes
177+
cluster-config-file /tmp/redis_cluster_node5.conf
178+
endef
179+
180+
define REDIS_CLUSTER_NODE6_CONF
181+
daemonize yes
182+
port 7384
183+
cluster-node-timeout 5000
184+
pidfile /tmp/redis_cluster_node6.pid
185+
logfile /tmp/redis_cluster_node6.log
186+
save ""
187+
appendonly no
188+
cluster-enabled yes
189+
cluster-config-file /tmp/redis_cluster_node6.conf
190+
endef
191+
156192
export REDIS1_CONF
157193
export REDIS2_CONF
158194
export REDIS3_CONF
@@ -166,6 +202,9 @@ export REDIS_SENTINEL3
166202
export REDIS_CLUSTER_NODE1_CONF
167203
export REDIS_CLUSTER_NODE2_CONF
168204
export REDIS_CLUSTER_NODE3_CONF
205+
export REDIS_CLUSTER_NODE4_CONF
206+
export REDIS_CLUSTER_NODE5_CONF
207+
export REDIS_CLUSTER_NODE6_CONF
169208

170209
start: cleanup
171210
echo "$$REDIS1_CONF" | redis-server -
@@ -183,6 +222,9 @@ start: cleanup
183222
echo "$$REDIS_CLUSTER_NODE1_CONF" | redis-server -
184223
echo "$$REDIS_CLUSTER_NODE2_CONF" | redis-server -
185224
echo "$$REDIS_CLUSTER_NODE3_CONF" | redis-server -
225+
echo "$$REDIS_CLUSTER_NODE4_CONF" | redis-server -
226+
echo "$$REDIS_CLUSTER_NODE5_CONF" | redis-server -
227+
echo "$$REDIS_CLUSTER_NODE6_CONF" | redis-server -
186228

187229
cleanup:
188230
- rm -vf /tmp/redis_cluster_node*.conf 2>/dev/null
@@ -202,19 +244,30 @@ stop:
202244
kill `cat /tmp/redis_cluster_node1.pid` || true
203245
kill `cat /tmp/redis_cluster_node2.pid` || true
204246
kill `cat /tmp/redis_cluster_node3.pid` || true
247+
kill `cat /tmp/redis_cluster_node4.pid` || true
248+
kill `cat /tmp/redis_cluster_node5.pid` || true
249+
kill `cat /tmp/redis_cluster_node6.pid` || true
205250
rm -f /tmp/sentinel1.conf
206251
rm -f /tmp/sentinel2.conf
207252
rm -f /tmp/sentinel3.conf
208253
rm -f /tmp/redis_cluster_node1.conf
209254
rm -f /tmp/redis_cluster_node2.conf
210255
rm -f /tmp/redis_cluster_node3.conf
256+
rm -f /tmp/redis_cluster_node4.conf
257+
rm -f /tmp/redis_cluster_node5.conf
258+
rm -f /tmp/redis_cluster_node6.conf
211259

212260
test:
213261
make start
214262
sleep 2
215263
mvn -Dtest=${TEST} clean compile test
216264
make stop
217265

266+
package:
267+
make start
268+
mvn clean package
269+
make stop
270+
218271
deploy:
219272
make start
220273
mvn clean deploy

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ All of the following redis features are supported:
4040
## How do I use it?
4141

4242
You can download the latest build at:
43-
http://github.com/xetorthio/jedis/downloads
43+
http://github.com/xetorthio/jedis/releases
4444

4545
Or use it as a maven dependency:
4646

4747
```xml
4848
<dependency>
4949
<groupId>redis.clients</groupId>
5050
<artifactId>jedis</artifactId>
51-
<version>2.2.1</version>
51+
<version>2.4.2</version>
5252
<type>jar</type>
5353
<scope>compile</scope>
5454
</dependency>

pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<packaging>jar</packaging>
1010
<groupId>redis.clients</groupId>
1111
<artifactId>jedis</artifactId>
12-
<version>2.4.2-SNAPSHOT</version>
12+
<version>2.5.0-SNAPSHOT</version>
1313
<name>Jedis</name>
1414
<description>Jedis is a blazingly small and sane Redis java client.</description>
1515
<url>https://github.com/xetorthio/jedis</url>
@@ -47,7 +47,7 @@
4747
<properties>
4848
<redis-hosts>localhost:6379,localhost:6380,localhost:6381,localhost:6382,localhost:6383,localhost:6384,localhost:6385</redis-hosts>
4949
<sentinel-hosts>localhost:26379,localhost:26380,localhost:26381</sentinel-hosts>
50-
<cluster-hosts>localhost:7379,localhost:7380,localhost:7381</cluster-hosts>
50+
<cluster-hosts>localhost:7379,localhost:7380,localhost:7381,localhost:7382,localhost:7383,localhost:7384,localhost:7385</cluster-hosts>
5151
<github.global.server>github</github.global.server>
5252
</properties>
5353

src/main/java/redis/clients/jedis/BasicRedisPipeline.java

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package redis.clients.jedis;
22

3+
import java.util.List;
4+
35
/**
46
* Pipelined responses for all of the low level, non key related commands
57
*/
@@ -24,6 +26,8 @@ public interface BasicRedisPipeline {
2426
Response<String> flushAll();
2527

2628
Response<String> info();
29+
30+
Response<List<String>> time();
2731

2832
Response<Long> dbSize();
2933

src/main/java/redis/clients/jedis/BinaryClient.java

+46-21
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,22 @@
11
package redis.clients.jedis;
22

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;
156

167
import java.util.ArrayList;
178
import java.util.List;
189
import java.util.Map;
1910
import java.util.Map.Entry;
2011

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;
2420

2521
public class BinaryClient extends Connection {
2622
public enum LIST_POSITION {
@@ -203,6 +199,10 @@ public void incrBy(final byte[] key, final long integer) {
203199
sendCommand(INCRBY, key, toByteArray(integer));
204200
}
205201

202+
public void incrByFloat(final byte[] key, final double value) {
203+
sendCommand(INCRBYFLOAT, key, toByteArray(value));
204+
}
205+
206206
public void incr(final byte[] key) {
207207
sendCommand(INCR, key);
208208
}
@@ -320,7 +320,7 @@ public void rpoplpush(final byte[] srckey, final byte[] dstkey) {
320320
public void sadd(final byte[] key, final byte[]... members) {
321321
sendCommand(SADD, joinParameters(key, members));
322322
}
323-
323+
324324
public void smembers(final byte[] key) {
325325
sendCommand(SMEMBERS, key);
326326
}
@@ -929,7 +929,15 @@ public void setbit(byte[] key, long offset, boolean value) {
929929
public void getbit(byte[] key, long offset) {
930930
sendCommand(GETBIT, key, toByteArray(offset));
931931
}
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+
933941
public void setrange(byte[] key, long offset, byte[] value) {
934942
sendCommand(SETRANGE, key, toByteArray(offset), value);
935943
}
@@ -1091,7 +1099,12 @@ public void restore(final byte[] key, final int ttl,
10911099
sendCommand(RESTORE, key, toByteArray(ttl), serializedValue);
10921100
}
10931101

1102+
@Deprecated
10941103
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) {
10951108
sendCommand(PEXPIRE, key, toByteArray(milliseconds));
10961109
}
10971110

@@ -1103,10 +1116,6 @@ public void pttl(final byte[] key) {
11031116
sendCommand(PTTL, key);
11041117
}
11051118

1106-
public void incrByFloat(final byte[] key, final double increment) {
1107-
sendCommand(INCRBYFLOAT, key, toByteArray(increment));
1108-
}
1109-
11101119
public void psetex(final byte[] key, final int milliseconds,
11111120
final byte[] value) {
11121121
sendCommand(PSETEX, key, toByteArray(milliseconds), value);
@@ -1253,4 +1262,20 @@ public void cluster(final byte[]... args) {
12531262
public void asking() {
12541263
sendCommand(Command.ASKING);
12551264
}
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+
}
12561281
}

0 commit comments

Comments
 (0)