开发者

Memcached replace not working

We're using memcached from PHP. I've been trying to figure out why we're seeing some issues where memcached doesn't seem to be updating. Can you think of any reason why a call to memcache->replace() wouldn't actually update the object? We're simply calling memcache->replace() on an array type object. The array does contain a lot of data, though I don't think we're exceeding the 1MB cap. The failure seems to happen intermittently. Most of the time it works but the occasional times it doesn't are a big deal to us. Also, does memcached execute synchronously or coul开发者_如何转开发d it be asynchronous? If it's asynchronous, there could be a race condition at work here.


I believe the memcache client is synchronous, but the replication is async, so if you are using replication perhaps the value is being written to one server and read from another before the replication completes. If you are using replication, see if you can reproduce the error without replication.


Why are you using replace rather than set? The semantics around replace allow it to fail if you're not overwriting data -- no data in particular, just some data.

If you want to overwrite specific data, use cas. If you just want to store data, use set.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜