I don't know about Roger, but in my situation queries are called as
follows.

my $queryhandle=Query("select blah from blah where blah")

the Query routine can be overloaded with a timeout value (a default
capable of being set), with a timeout of 0 meaning that the select
should never be cached and should always be selected live from the
database. I'd assume Roger would need to have something similar in the
module he's developing.

regards,

P



On Fri, 8 Sep 2000, Drew Taylor wrote:

> Roger Espel Llima wrote:
> > 
> > I've written a very small module to cache SELECT results from DBI
> > requests.  The interface looks like:
> > 
> >   use SelectCache;
> > 
> >   my $db = whatever::get_a_handle();
> >   my $st = qq{ select this, that ... };
> >   my $rows = SelectCache::select($db, $st, 180);
> > 
> > this returns an arrayref of rows (like the selectall_arrayref function),
> > and caches the result in a file, which gets reused for 180 seconds
> > instead of asking the db again.
> > 
> > The names of the cache files are the md5's of the select statement,
> > using the last hex digit as a subdirectory name.  There's no file
> > cleanup function; you can always do that from cron with find.
> > 
> > This is all very simple, but it's pretty useful in combination with
> > mod_perl, to speed up things like showing the "latest 10 posts", on
> > frequently accessed webpages.
> > 
> > The question now is: is there any interest in releasing this?  I could
> > write some minimal docs and give it a 'proper' module name, if there's
> > interest.
> I'm certainly interested. One question though - in the module do you
> blindly use the cache? I ask because in my instance I display the
> contents of a shopping cart on every page. And while only a few pages
> change the cart contents, the cart listing does need to be current. How
> do you handle this situation?
> 
> 

-- 
.-----------------------------------------------------.
|       Peter Skipworth        Ph: 03 9897 1121       |
|      Senior Programmer      Mob: 0417 013 292       |
|      realestate.com.au   [EMAIL PROTECTED]     |
`-----------------------------------------------------'

Reply via email to