Repeat one connection for each application

I am new to Redis and want to know if it is good practice to open a client connection while my Java application is running. This connection will be used by various functions.

Or an alternative is better: defining each connection to a method, which then connects, establishes, or receives data and closes the connection at the end.

Which one is desired?

Thank.

Note. I use Redis customer salad

+4
source share
2 answers

, , . TCP 1 1 .

. docs state

lettuce Redis Standalone Redis Sentinel. , . . .

. Redis , , , jedis, , .


, , . , :

, BLPOP, BRPOP,... . , , Redis

Redis, (, ). Redis . - : , , , - .

(MULTI/EXEC). . , , .

, . null, transactions, , . , .

+4

redis . , , .

+1

All Articles