Skip to content

Latest commit

 

History

History
58 lines (36 loc) · 1.38 KB

README.md

File metadata and controls

58 lines (36 loc) · 1.38 KB

ddth-redis

DDTH's Redis Libraries and Utilities: simplify Redis's usage.

Project home: https://github.com/DDTH/ddth-redis

OSGi environment: ddth-redis is packaged as an OSGi bundle.

License

See LICENSE.txt for details. Copyright (c) 2014 Thanh Ba Nguyen.

Third party libraries are distributed under their own licenses.

Installation

Latest release version: 0.4.0. See RELEASE-NOTES.md.

Maven dependency:

<dependency>
	<groupId>com.github.ddth</groupId>
	<artifactId>ddth-redis</artifactId>
	<version>0.4.0</version>
</dependency>

Usage

// obtain a redis client factory
RedisClientFactory factory = RedisClientFactory.newFactory();

// obtain a redis client object from pool
IRedisClient client = factory.getRedisClient("localhost");
IRedisClient client = factory.getRedisClient("localhost", 6379);
IRedisClient client = factory.getRedisClient("localhost", 6379, "user", "password");
IRedisClient client = factory.getRedisClient("localhost", 6379, "user", "password", poolConfig);

//do something with the client
client.set("key", "value", ttl);
...

client.close(); //close and return the client to pool when done

factory.destroy(); //destroy the factory when done

Credits

  • Jedis is the underlying Redis library.