遇到好几次同事和朋友问“redis是线程(进程)安全吗?”
Redis is a single-threaded server. It is not designed to benefit from multiple CPU cores. People are supposed to launch several Redis instances to scale out on several cores if needed. It is not really fair to compare one single Redis instance to a multi-threaded data store.so as every command gets queued in a single thread you should be ok as there will never be two commands executing in parallel
翻译:redis是单线程服务器。它的设计并不能从多核cpu中受益。人们可以安装多个redis实例来提高多核cpu的利用率。拿redis更多线程存储服务器做对比是不公平的。每个请求被缓存在一个线程中,一个时间只能有一个线程在处理请求。
参考文献:http://stackoverflow.com/questions/11658272/is-redis-list-or-set-pop-method-thread-safe