* @param timeout The socket timeout or 0 to use the default socket timeout
* @param poolConfig The pool {@link Config}
*/
public JredisPool(String hostName, int port, int dbIndex, String password, int timeout,
GenericObjectPoolConfig poolConfig) {
ConnectionSpec connectionSpec = DefaultConnectionSpec.newSpec(hostName, port, dbIndex, null);
connectionSpec.setConnectionFlag(Connection.Flag.RELIABLE, false);
if (StringUtils.hasLength(password)) {
connectionSpec.setCredentials(password);
}
if (timeout > 0) {
connectionSpec.setSocketProperty(Property.SO_TIMEOUT, timeout);
}
this.internalPool = new GenericObjectPool<JRedis>(new JredisFactory(connectionSpec), poolConfig);
}