I\'m trying to update a variable in APC, and will be many processes trying to do that.
APC doesn\'t provide locking functionality, so I\'m considering using other me
APC is now considered unmaintained and dead. It's successor APCu offers locking via apcu_entry. But be aware, that it also prohibits the concurrent execution of any other APCu functions. Depending on your use case, this might be OK for you.
From the manual:
Note: When control enters
apcu_entry()the lock for the cache is acquired exclusively, it is released when control leavesapcu_entry(): In effect, this turns the body ofgeneratorinto a critical section, disallowing two processes from executing the same code paths concurrently. In addition, it prohibits the concurrent execution of any other APCu functions, since they will acquire the same lock.