Skip to content

Commit f2efa05

Browse files
committed
add some docs
1 parent ca5fa00 commit f2efa05

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,13 @@ redis.pipeline()
6161
This 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?
6773
However 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,
7884
you probably want to implement a pool.
7985

8086
Summarizing, 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?
8494
Feel free to report issues here.

0 commit comments

Comments
 (0)