1. A method of writing data to a file system in a non-volatile memory, the method comprising: opening a file stream for writing to a file in the file system; attaching a life expectancy value to the file stream, the life expectancy value being a prediction of a length of time the data to be written will be stored in the file system; writing the data to the file stream; and causing the data written to the file stream to be written to the non-volatile memory according to the life expectancy value attached to the data.