On Sun, Oct 21, 2001 at 12:55:31PM -0700, Terrence Brannon wrote:
> 
> On Wednesday, October 17, 2001, at 02:48 AM, Tim Bunce wrote:
> 
> >> The module I propose to develop (the second RFC of this email), makes 
> >> it
> >> clear why this would be useful.
> >
> > Er, actually it's not very clear to me.
> 
> all I am saying here is: if a subclass needed to create unique keys into 
> a data cache as a function of prepare and execute arguments, it could 
> not re-use the code the DBI.pm uses to create such unique keys because 
> they are not callable subs in the DBI namespace.
> 
> e.g.
> 
> package DBI::MySubclass::db;
> sub prepare {
>     my ($dbh, $query, @rest) = @_:
>     my $prepare_key = DBI::generate_key($query,@rest);


You want to be able to ignore some params to prepare_cached() in
order to have a statement handle be reused by a prepare call that
passes different parameters?

I can't see sufficient cases where someone would want to do that
and not also be subclassing prepare/prepare_cached etc


> > Are you trying to add global result-caching by just connecting via a 
> > subclass?
> >
> > I've long planned to add result-caching but I don't think it's that
> > simple (in general) and doing it globally (without per-query coding)
> > is probably not what most people want.
> 
> having spent the last two days tearing my hair out to beat plain DBI 
> with my module DBI::Cache, which sits on top of MLDBM::Sync. In some 
> cases the wallclock seconds would be about the same, but plain dbi 
> requires less user and sys time so it had better results from 
> Benchmark.pm

The DBI docs do say that it's fast :-)  [Of course, your code could
be made faster and selecting more rows would reduce the significance
of setup overheads.]

> > (I'd expect it to grow out of adding a 'cursor library' and
> > fetch_scroll() [or whatever it's called] method and saving/reusing
> > the data cache that that would need. But that doesn't preclude other
> > approaches.)
> 
> If we as a group could spec out what is desired, then I would be happy 
> to implement it.

Thanks.

> I attach DBI::Cache, which also entered CPAN as proof-of-concept for 
> this discussion:
> 
> 
>http://princepawn.perlmonk.org/domains/semantic-elements.com/cpan/DBI-Cache-1.06.tar.gz

Tim.

p.s. All your private attribute names should begin with something more
specific to your module so clear_private won't trample on other peoples
private attributes - see the docs.

p.p.s. the DBI::* namespace is reserved. Please delete and upload
as DBIx::Cache or similar.  Thanks.

Reply via email to