News Feed
Sections




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

Elijaa.org:
Using cas() command from PECL Memcached
October 06, 2010 @ 09:16:44

On Elijaa.org there's an interesting post (from back in May 2010) about using the "cas()" command in the memcached PECL extension to update the cached value of an object while preventing collisions with other scripts that might be updating the same value.

A series of commands is not atomic. If you issue a 'get' against an item, operate on the data, then wish to 'set' it back into memcached, you are not guaranteed to be the only process working on that value. In parallel, you could end up overwriting a value set by something else. [...] But PECL Memcached come with a useful function : cas().

The "cas()" function uses a checksum pulled out when the data is uplled using "get()". This token along with the updated data is passed into the "cas()" method that does the additional checking for you. A code snippet is included to show you its use.

0 comments voice your opinion now!
pecl memcached cas checksum tutorial


blog comments powered by Disqus

Similar Posts

SitePoint PHP Blog: Build your own PHP Framework with Symfony Components

PHPBuilder.com: MySQL and PHP: How to make it work without killing your server

Andrew Perkin's Site: Cakephp Video Tutorials (Authentication)

Zend Developer Zone: MySQLND, MySQL_UH and other goodies available to PHP programmers

Eli White's Blog: An intriguing use of lambda functions


Community Events





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


voicesoftheelephpant interview framework api deployment release bugfix library podcast opinion symfony list tips package introduction series install community language laravel

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