Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Caching for SQLite

by bash (Scribe)
on Sep 03, 2007 at 13:36 UTC ( [id://636731]=perlquestion: print w/replies, xml ) Need Help??

bash has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Caching for SQLite
by andreas1234567 (Vicar) on Sep 03, 2007 at 18:45 UTC
    Wikipedia defines cache as:
    A collection of data duplicating original values stored elsewhere or computed earlier, where the original data is expensive to fetch.
    What operation have you determined to be too expensive to retrieve from your SQLite database?

    If SQLite isn't up for the task in question, consider your options.

    --
    Andreas
      Expensive - Disk I/O. I have web site with ~30k uniq host/day. All pages at this site are generated by perl+SQLite. Database size ~ 5Gb. Database updates only once per day, so it's should be very easy to cache popular sql's select statements.

        You shouldn't cache the results of SQL select statements but better cache the complete results, for example as HTML. Or consider creating the complete website as static pages (or at least the parts that will be requested most). If you need authentication etc., have that part dynamic but include the static parts directly from disk.

Re: Caching for SQLite
by Anonymous Monk on Sep 03, 2007 at 16:18 UTC
    define "solution"
      something like this
      sub get_foo_object { my $foo_id = int(shift); my $obj = $Cache->get("$foo_id"); return $obj if $obj; $obj = $db->selectrow_hashref("SELECT .... FROM foo f, bar b ". "WHERE ... AND f.fooid=$foo_id"); $Cache->set("$foo_id", $obj); return $obj; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://636731]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (2)
As of 2024-04-26 07:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found