https://github.com/codislabs/jodis
A java client for codis based on Jedis and Curator
https://github.com/codislabs/jodis
Last synced: 6 months ago
JSON representation
A java client for codis based on Jedis and Curator
- Host: GitHub
- URL: https://github.com/codislabs/jodis
- Owner: CodisLabs
- License: mit
- Created: 2015-10-14T05:23:30.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2019-01-30T03:02:16.000Z (about 7 years ago)
- Last Synced: 2025-10-13T06:03:36.097Z (6 months ago)
- Language: Java
- Homepage:
- Size: 41 KB
- Stars: 218
- Watchers: 26
- Forks: 96
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Jodis - Java client for codis
[](https://travis-ci.org/CodisLabs/jodis)
Jodis is a java client for codis based on [Jedis](https://github.com/xetorthio/jedis) and [Curator](http://curator.apache.org/).
# Features
- Use a round robin policy to balance load to multiple codis proxies.
- Detect proxy online and offline automatically.
# How to use
Add this to your pom.xml. We deploy jodis to https://oss.sonatype.org.
```xml
io.codis.jodis
jodis
0.5.1
```
To use it for Codis2.x:
```java
JedisResourcePool jedisPool = RoundRobinJedisPool.create()
.curatorClient("zkserver:2181", 30000).zkProxyDir("/zk/codis/db_xxx/proxy").build();
try (Jedis jedis = jedisPool.getResource()) {
jedis.set("foo", "bar");
String value = jedis.get("foo");
System.out.println(value);
}
```
Or for Codis3.x with `jodis_compatible=false`:
```java
JedisResourcePool jedisPool = RoundRobinJedisPool.create()
.curatorClient("zkserver:2181", 30000).zkProxyDir("/jodis/xxx").build();
try (Jedis jedis = jedisPool.getResource()) {
jedis.set("foo", "bar");
String value = jedis.get("foo");
System.out.println(value);
}
```
Note: JDK8 is required to use and build jodis, as JDK7 has been EOL since May 2015.