Important notes on the Jedis code
The Jedis implementation initializes only when you attempt to perform an operation over the Connection
object. This type of initialization is useful when you manage thousands of connections.
When you destroy a connection, you must destroy all related resources. To prevent a state of inconsistency, the destroy
and the getPool
methods are synchronized.
You must explicitly close the Jedis connection. For
example, if you use the ping
method, you retrieve a connection from the
pool, run a call, and close the connection by returning it to the pool. If you want to
run multiple calls, you must retrieve a connection multiple times. For performance
reasons, you can expose the Jedis object to the users.