A connect_cached() example
 
 
- Compare and contrast...
- 
my $dbh = DBI->connect(…);
 
 sub lookup_foo_1 {
 my ($id) = @_;
 $sth = $dbh->prepare_cached("select foo from table where id=?");
 return $dbh->selectrow_array($sth, $id);
 }
 
 
- with...
- 
sub lookup_foo_2 {
 
 my ($id) = @_;
 my $dbh = DBI->connect_cached(…);
 $sth = $dbh->prepare_cached("select foo from table where id=?");
 return $dbh->selectrow_array($sth, $id);
 }
 
 
Clue: what happens if the database is restarted?