I recommend that you study Using SQLite In Multi-Threaded Applications.

My concern is that because of the use of threads in such frameworks, keeping a DB handle over time will lead to problems. (let's say I keep the handle for 100 queries, then refresh it) There is no problem keeping a handle for a very long time. There is no need to "refresh" it. A handle and any statement prepared for that handle can only be used in a single thread. Read my above suggested link.

Update: SQLite requires an exclusive lock when writing the DB. It will take care of doing this by itself, but be aware that this can have a huge impact upon performance. Fixed bad link above.


In reply to Re: Database access and async web framework (like Mojolicious) by Marshall
in thread Database access and async web framework (like Mojolicious) by bliako

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.