Multiple Cfilecache Writing To Same File At The Same Time

Hey guys, I’ve ran into a bit of an issue using CFileCache. Basically if two simultanous page loads write to the same cache file this can (and has) result in corruption of data in that file.

I was wondering if I was missing anything to do with locking or similar that would already be implemented. Or do I have to come up with my own solution?

Thanks in advance

CFileCache writes data with:


and LOCK_EX flag according to PHP documentation stands for "Acquire an exclusive lock on the file while proceeding to the writing."

so… it should not cause problems with simultaneous access…

That’s very interesting!! I didn’t check that far in. In that case I’m indeed mistaking and the issue lays elsewhere (mea culpa).

Maybe the issues lay in the locks of the files used to generate the cache file content.

Thanks a lot!!