News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Abhinav Singh's Blog:
How to use locks for assuring atomic operation in Memcached?
December 09, 2009 @ 11:20:42

In a new post to his blog Abhinav Singh shows you how to create a simple application that uses the memcached atomic increment command to help prevent concurrency issues.

Memcached provide atomic increment and decrement commands to manipulate integer (key,value) pairs. However special care should be taken to ensure application performance and possible race conditions while using memcached. In this blog post, I will first build a facebook style "like" application using atomic increment command of memcached. Also, I will discuss various technical difficulty one would face while ensuring atomicity in this application. Finally, I will demo how to ensure atomicity over a requested process using custom locks in memcached.

Example code is included to show how you can take a normal "store to memcached" example and modify it with the increment method to resolve issues that might come up from one or more scripts trying to get at the same values. He also includes an example of using locking to provide a similar effect.

4 comments voice your opinion now!
memcached atomic operation tutorial


blog comments powered by Disqus

Similar Posts

Zend Developer Zone: Scalability and Responsiveness with Zend Platform's Job Queue

HowTo Forge: How To Harden PHP5 With Suhosin On Fedora 7

DevShed: Understanding Destructors in PHP 5

PHPImpact Blog: Building a Web Service Client using the Zend Framework

EchoDitto Labs Blog: How to Configure Eclipse PDT with Zend Server Debugger on MAMP for Drupal


Community Events





Don't see your event here?
Let us know!


introduction interview symfony code series list tips community release api podcast deployment laravel bugfix voicesoftheelephpant language threedevsandamaybe framework zendserver conference

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework