Feature request: lock a key
Per Wigren
wigren at home.se
Fri Sep 10 03:03:26 PDT 2004
Hi! I'm new to this list but I have used memcached a bit and I love it, but there is a feature that I REALLY want: The ability to lock a key so any other processes that try to get it will wait until it is unlocked again.
Consider this example:
$local_array = $cache->get('global_array');
array_push($local_array, 'I want to be here too!');
$cache->set('global_array', $local_array);
This will cause a race contition when several processes will try to update the array at the same time.
lock/unlock methods would solve this:
$cache->lock('global_array',$ttl);
$local_array = $cache->get('global_array');
array_push($local_array, 'I want to be here too!');
$cache->set('global_array', $local_array);
$cache->unlock('global_array');
Regards,
Per Wigren
More information about the memcached
mailing list