halfway coding the save functionality...

implemented locking of cache to iterate the items to get them into the file.
implemented the writing mode of the fm to allow file writing.
these stuff should only be called inside the save method.

Signed-off-by: Nicholas Lum <nicholaslum444@hotmail.com>