![]() |
|
No such thing as a small change | |
PerlMonks |
Re^3: File Lockingby Anonymous Monk |
on May 07, 2008 at 21:58 UTC ( [id://685336]=note: print w/replies, xml ) | Need Help?? |
If you're pretty sure the friend is not on the list, then locking the file exclusive for the entire operation is a good idea.
However, locking the file in LOCK_EX (instead of LOCK_SH) will limit the concurrency of the operation to 1. So if you just want to check if they are (not) on the list, a shared lock will scale better. Check again after you get an exclusive lock, to avoid race conditions. (For even better scalability, use a database.)
In Section
Tutorials
|
|