The AutoFlushCommands state is set per connection and therefore affects all threads using the shared connection. If you want to omit this effect, use dedicated connections. The AutoFlushCommands state cannot be set on pooled connections by the Lettuce connection pooling.spring-data-redis里执行pipeline命令,会先申请一个私有毗连,虽然它的刷入命令的战略有题目,但这个可以参考下。
Switching setAutoFlushCommands to false is only recommended for single-threaded connection use that wants to optimize command buffering for batch imports.只保举在单线程的应用中利用setAutoFlushCommands来手动刷命令。Lettuce通常以非阻塞、多路复用模式工作,与利用什么API无关,不管是同步/异步/响应式API。如果你不碰这东西,就没事了。
Lettuce works in general in a non-blocking, multiplexing mode regardless of the API that you're using. You can use synchronous, asynchronous, any reactive APIs with the same connection.
That being said, if you don't touch setAutoFlushCommands, you should be good.
If you manually control the flushing behavior of commands (setAutoFlushCommands(true/false)), you should have a good reason to do so. In multi-threaded environments, race conditions may easily happen, and commands are not flushed. Updating a missing or misplaced flushCommands() call might solve the problem.意思是,修改在AutoFlushCommands这个配置的时间必要注意,多线程情况中,竞态会频繁出现,命令将会阻塞,修改在不当的场景下利用手动刷入flushCommands大概会解决题目。
欢迎光临 ToB企服应用市场:ToB评测及商务社交产业平台 (https://dis.qidao123.com/) | Powered by Discuz! X3.4 |