File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -61,7 +61,13 @@ redis.pipeline()
6161This will result in a ` List<Object> ` containing a list for each of the responses.
6262
6363## Is the connection thread safe?
64- No. You need to make sure that the connection is accessed atomically.
64+ No. You need to make sure that the connection is accessed atomically. However,
65+ there is a ` Redis.run() ` method which you can use to do some simple redis
66+ operations in isolation. It creates a connection and closes it directly after:
67+
68+ ``` java
69+ nl.melp.redis. Redis . run((redis) - > redis. call(" INCR" , " mycounter" ));
70+ ```
6571
6672## How should I manage my connections?
6773However you wish. This library is a protocol implementation only. Managing a
@@ -78,7 +84,11 @@ creating a lot of threads and not a lot of these threads need the connection,
7884you probably want to implement a pool.
7985
8086Summarizing, this is a trade-off which you can decide on for your own.
81- Generally speaking: don't overcomplicate stuff without good reason.
87+ Generally speaking: don't overcomplicate stuff without good reason.
88+
89+ In terms of performance: creating socket connections on-the-fly is comparable
90+ to reusing connections. See the performance tests inside RedisTest for more
91+ information.
8292
8393## Questions? Issues?
8494Feel free to report issues here.
You can’t perform that action at this time.
0 commit comments