Memcached, Locking and Race Conditions

Viewed 22265

We are trying to update memcached objects when we write to the database to avoid having to read them from database after inserts/updates.

For our forum post object we have a ViewCount field containing the number of times a post is viewed.

We are afraid that we are introducing a race condition by updating the memcached object, as the same post could be viewed at the same time on another server in the farm.

Any idea how to deal with these kind of issues - it would seem that some sort of locking is needed but how to do it reliably across servers in a farm?

4 Answers
Related