redis 对数据结构的操作是线程安全的吗 [英] Are redis operations on data structures thread safe

查看:42
本文介绍了redis 对数据结构的操作是线程安全的吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Redis 如何处理多个线程(来自不同客户端)更新 Redis 中的相同数据结构?对于这种用例,推荐的最佳实践是什么?

How does Redis handle multiple threads (from different clients) updating the same data structure in Redis ? What is the recommended best practice for such a use case?

推荐答案

如果你在某个时候阅读了 Little redis 书,就会出现这句话.

if you read the Little redis book at some point this sentence comes.

您可能不知道,Redis 实际上是单线程的,这就是保证每个命令都是原子的.当一个命令正在执行时,其他命令不会运行."

"You might not know it, but Redis is actually single-threaded, which is how every command is guaranteed to be atomic. While one command is executing, no other command will run."

查看http://openmymind.net/2012/1/23/The-Little-Redis-Book/ 了解更多信息

问候

这篇关于redis 对数据结构的操作是线程安全的吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆