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.
--
Roger Espel Llima, [EMAIL PROTECTED]
http://www.iagora.com/~espel/index.html