_____ _ _
|_ _| ___ __| | (_) ___
| | / _ \ / _` | | | / __|
| | | __/ | (_| | | | \__ \
|_| \___| \__,_| |_| |___/
Tedis is a redis client based on tcp & resp.
- synchronous API
- asynchronous API
- connection pool
- single node distributed lock
- bloom-filter
- validate conn activation & auto-retry
- check issue permission(in annotation) using dynamic proxy
- pipeline
- subscribe/publish
- Lua script
- SSL
- Redis Cluster
- Request/Response mode
public void pingTest() {
Tedis tedis = TedisClient.tedis();
tedis.ping();
tedis.ping("HELLO");
tedis.close();
}
- Pipeline
public void pipelineTest() {
Tedis tedis = TedisClient.tedis();
tedis.setMode(TedisClient.PIPELINE);
tedis.get("a");
tedis.set("a", "1");
tedis.get("a");
Results r = tedis.submit().sync(); // nil, OK, 1
tedis.close();
}
- SUB/PUB
public void subpubTest() {
Tedis tedis = TedisClient.tedis();
tedis.subscribe("news");
tedis.unsubscribe("news");
tedis.psubscribe("n*");
tedis.punsubscribe("n*");
tedis.publish("news", "foobar");
tedis.close();
}
- Lock
public lockTest() {
Tedis tedis = TedisClient.tedis();
TedisLock lock = tedis.newLock();
try {
lock.lock();
//...
} finally {
lock.unlock();
}
tedis.close();
}
- BloomFiter
public bloomFilterTest() {
Tedis tedis = TedisClient.tedis();
// int a: insertions
// double b: falseProbability
BloomFilter bf = tedis.newBloomFilter(a, b);
bf.add("str");
assertTrue(bf.include("str"));
tedis.close()
}
- More in Test Class