[Interest] Simple doubt on file i/o

alexander golks alex at golks.de
Thu Jun 27 09:31:15 CEST 2013

> Thoughts?

i would use a "cache" QMap, and keep it in sync just when needed.
fill the cache from file on load/construction/first access, write the cache to
file on destruction, thus you won't have any file access during setter/getter

you can do file handling in a thread to not block callers, 
you can force a write via timeout signal, e.g. 
"do threaded sync to file after 5 seconds of last change to cache".

pay attention to thread-safety if you need it.

 *  An honest tale speeds best being plainly told.
 *      -- William Shakespeare, "Henry VI"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130627/acaf2145/attachment.sig>

More information about the Interest mailing list