Hi all,

Now that the three ad hoc file writes in mod_disk_cache have been grouped together into one place (commit_entity()), the last step is to ensure that the three writes happen atomically.

Ideally, the locking of url A should have no effect on url B, so a separate lock file per .header/.data file should be needed.

Will a simple apr_file_lock() on a per-URL lock file do the trick, or will performance be a killer?

The alternative is to change the format of the disk cache so that the .data file has a temporary filename, for example XYZ.data.12367 instead of just XYZ.data, and then to key the string "12367" in the header file. The new data file can be written alongside the old one if necessary at leisure, and only when the header file is renamed into place will the new data file come into effect. This avoids locks entirely.

Thoughts?

Regards,
Graham
--

Reply via email to