i would prefer a solution wich could handle different
kind of solutions. it means the user can choose between
flock()-, semaphore- or your workaround- style to
prevent data corruption .
good idea. but especially for something like a cache class, performance is
very important, so i would say: KISS (keep it simple stupid ... )
that does not say, that i think, it doesn't need file locking
I agree that for cache classes it is important to stick with KISS.
Maybe adding set_file_buffer($f, 0); to write unbuffered still would be a good idea. Since then I didn't notice any more corrupt cache data on our site, even though it still might happen.
The other changes were to avoid the concurrent cpu intensive data generation processes, which most people might not have a problem with. So keeping that part out probably is a good idea.
Vinai