Practical mod_perl / HTML Book /



previous page: 20.2.1. Preopening DBI Connections
  
page up: HTML Version of the book
  
next page: 20.2.3. Efficient Record-Retrieval Techniques

20.2.2. Improving Speed by Skipping ping( )


If you use Apache::DBI and want to save a little bit of time, you can change how often the ping( ) method is called. The following setting in a startup file:

Apache::DBI->setPingTimeOut($data_source, $timeout)

will change this behavior. If the value of $timeout is 0, Apache:DBI will validate the database connection using the ping( ) method for every database access. This is the default. Setting $timeout to a negative value will deactivate the validation of the database handle. This can be used for drivers that do not implement the ping( ) method (but it's generally a bad idea, because you don't know if your database handle really works). Setting $timeout to a positive value will ping the database on access only if the previous access was more than $timeoutseconds earlier.

$data_source is the same as in the connect( ) method (e.g., DBI:mysql:...).

 

Continue to:

  • prev: 20.2.1. Preopening DBI Connections
  • Table of Contents
  • next: 20.2.3. Efficient Record-Retrieval Techniques







TOP
previous page: 20.2.1. Preopening DBI Connections
  
page up: HTML Version of the book
  
next page: 20.2.3. Efficient Record-Retrieval Techniques


Menu

  • HTML Book
  • PDF Book
  • Download Code
  • Table of Contents
  • Errata
  • mod_perl2 User's Guide
  • Sitemap

Search


Add to Google




Creative Commons License


Written by
Eric Cholet (Logilune) and
Stas Bekman (StasoSphere & Free Books).


[ Privacy Policy | Terms of Use | About Us | Search ]

© 2007 StasoSphere.com