Hi,
i need a locking in memcache. Since all operations are atomic that should be an easy task. My idea is to use a basic spin-lock mechanism. So every object that needs locking in memcache gets a lock object, which will be polled for access.
// pseudo code
// try to get a lock
int lock;
do
{
lock = Memcache.increment("lock", 1);
}
while(lock != 1)
// ok we got the lock
// do something here
// and finally unlock
Memcache.put("lock", 0);
How does such a solution perform? Do you have a better idea how to lock a memcache object?
Best regards,
Friedrich Schick