News for hackers. Stuff that matters.
Re:What are the best non-database solutions you've seen? Wha... by shiro on Thursday April 19, 2007 @07:25PM (#14843)
A few techniques I've used:

If the file is small, I write to a tmp file then rename.

If multiple files are involved, I write new data to fresh files, then update the "master" file atomically that has pointer to the data files.

If lots of data is constantly added, I just keep appending to a file, but design the format so that I can always find the record boundary even if the last append was chopped by server crash.

There are no comments on this comment yet.