The content below come from http://try.redis.io/?
There is something special about?INCR. Why do we provide such an operation if we can do it ourself with a bit of code? After all it is as simple as:
x = GET count
x = x + 1
SET count x
The problem is that doing the increment in this way will only work as long as there is a single client using the key. See what happens if two clients are accessing this key at the same time:
Client A reads?count?as 10.
Client B reads?count?as 10.
Client A increments 10 and sets?count?to 11.
Client B increments 10 and sets?count?to 11.
以上就是土嘎嘎小编为大家整理的Redis 原子操作INCR相关主题介绍,如果您觉得小编更新的文章只要能对粉丝们有用,就是我们最大的鼓励和动力,不要忘记讲本站分享给您身边的朋友哦!!