You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because adding a `try-with-resources` block for each command can be cumbersome, consider using `JedisPooled` as an easier way to pool connections. `JedisPooled`, added in Jedis version 4.0.0, provides capabilities similar to `JedisPool` but with a more straightforward API.
System.out.println(jedis.get("foo")); // prints "bar"
356
+
```
322
357
323
-
As mentioned in the previous section, use `JedisPool` or `JedisPooled` to create a connection pool.
324
-
`JedisPooled`, added in Jedis version 4.0.0, provides capabilities similar to `JedisPool` but with a more straightforward API.
325
358
A connection pool holds a specified number of connections, creates more connections when necessary, and terminates them when they are no longer needed.
326
359
327
360
Here is a simplified connection lifecycle in a pool:
The following sections explain how to handle situations that may occur
406
+
in your production environment.
407
+
370
408
### Timeouts
371
409
372
410
To set a timeout for a connection, use the `JedisPooled` or `JedisPool` constructor with the `timeout` parameter, or use `JedisClientConfig` with the `socketTimeout` and `connectionTimeout` parameters:
0 commit comments