[Interest] Simple doubt on file i/o

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Thu Jun 27 10:00:03 CEST 2013

On Thu, Jun 27, 2013 at 1:01 PM, alexander golks <alex at golks.de> wrote:

> > 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
> functions.
> 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".

I agree with this method, though I believe it's a bit of an overkill for my
simplistic requirement.

Also, after the first access, the contents of the file will be cached in
the filesystem cache itself (which is in memory). Though there'll still be
the overhead of making a syscall to access that.


> and:
> pay attention to thread-safety if you need it.
> --
> /*
>  *  An honest tale speeds best being plainly told.
>  *      -- William Shakespeare, "Henry VI"
>  */
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130627/49bdf75c/attachment.html>

More information about the Interest mailing list