1

Does anybody know if DataCache.Increment is thread safe? (I.e. can I call it simultaneously in parallel on different machines and/or threads without worrying about the calls overwriting each other?)

The documentation doesn't mention anything about Thread Safety even though I'm guessing the methods is there just for this reason. But still, I don't want to rely on assumption when building my app.

4

2 回答 2

0

API 是线程安全的(内部锁定确保所有这些)。

于 2012-10-04T18:53:43.157 回答
0

在这种情况下,Azure 缓存通过锁定在内部处理并发。不幸的是,我无法通过链接支持这一点,只是过去的经验,因为我们目前在生产中使用此功能。

为了更加确定,您始终可以编写一个快速工作角色,该角色并行递增,然后验证返回的 Int64。

于 2012-09-18T10:23:24.017 回答