Actually now that I'm looking into this more deeply, turns out I'm already doing exactly that. At least on OS X. There I can't get that :memory: to work with ?cache=shared, so it always uses a file in the end. I get this with your latest code:

$ ls -l file* ls: file*: No such file or directory $ ./test.pl > /dev/null $ ls -l file* -rw-r--r-- 1 19456 Jul 24 22:46 file:memdb2?mode=memory&cache=shared $ ./test3.pl > /dev/null $ ls -l file* -rw-r--r-- 1 36864 Jul 24 22:46 file:memdb2?mode=memory&cache=shared

When I use 'dbi:SQLite:dbname=:memory:' alone, it creates the database in-memory (no file), but I can't share it so that's no use.

I've also tried all of these different URIs, but no joy (below are the corresponding files that get created):

CONNECT=> 'dbi:SQLite:dbname=file:memory:?mode=memory&cache=shared' 19456 Jul 24 23:15 file:memory:?mode=memory&cache=shared CONNECT=> 'dbi:SQLite:dbname=:memory:?cache=shared' 19456 Jul 24 23:18 :memory:?cache=shared CONNECT=> 'dbi:SQLite:dbname=:memory:\?cache=shared' 19456 Jul 24 23:19 :memory:\?cache=shared CONNECT=> 'dbi:SQLite:dbname=:memory:cache=shared' 19456 Jul 24 23:20 :memory:cache=shared CONNECT=> 'dbi:SQLite:dbname=:memory?cache=shared:' 19456 Jul 24 23:21 :memory?cache=shared:

So far when I use the file it's fast enough for what I need. But just out of curiosity, any chance that ?cache=share can be set outside of the URI in some way?


In reply to Re^10: threads::shared seems to kill performance (Workaround). by Jacobs
in thread threads::shared seems to kill performance by Jacobs

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.