On 9/28/06 7:45 PM, Jonathan Vanasco wrote:
> i found it odd how a lot of the data was cached as a per-db stash,  the bulk
> of  it seemed redundant.  i imagine there are some edge cases where different
> DBs interact with the data in other ways.

There are a lot more cases than you might think.  Trying to correctly detect
and handle those on a case-by-case basis is error-prone.  Dividing all
cached metadata by db neatly solves the problem at a relatively small cost.

> I  was unsure of how to alter any options of a registered db post-config.

Try modify_db()

http://search.cpan.org/dist/Rose-DB/lib/Rose/DB.pm#modify_db
 
> i couldn't catch how the prime_caches exactly operates though (in
> terms of where its originally triggered).  so i'm going to ask these
> questions:
> 
> a- currently, does this happen in a single connect, or is this on a
> per connect/disconnect basis

It'll be called automatically from within initialize() (which is called from
setup()) if the meta->auto_prime_caches setting is true:

http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/Metadata.pm#au
to_prime_caches

It defaults to true under mod_perl but you can change it to whatever you
want.  If you turn it off, I suggest calling prime_all_caches() manually at
the end of startup.pl after you've loaded all your RDBO classes.

Or you could not call it at all.  It's just an optimization to attempt to
increase the amount of shared memory in each apache child.

> c- i know that its just SELECT arguments, but would it be possible
> to 'play it safe' and have an option to run the cache primes in begin/
> rollback blocks?

There's no reason to do that.  None of the cached stuff changes when
begin_work() or rollback() is called.

> e- fyi, if you unregister a db, the object classes still retain the
> per-db info.  they should probably discard it.

The problem is, how would they know that the db was unregistered?

> the reason why i'd like to do prime_all and a connect-disconnect is
> that i have a config db handle in modperl already that i do some
> class overloading to , in efforts to make sure I disconnect
> ( sometimes I change code around and Apache::DBI gets called in too
> soon.   )  i'd love to just bool off cache priming, then run the
> whole cache priming with my dbh , and be able to make sure it
> disconnects.
>
> [code snipped]

Sure, why not.  In the meantime, you can use the code you wrote in your own
custom metadata class.

-John



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to