title: PHP PDO Caching
body: <p>I've been looking for an answer to this but haven't found it anywhere.  Are calls to PDO::prepare() cached, or should I cache the result myself, i.e. if I do the following</p>
  
  <pre><code>function foo () {
    $handle = PDO::prepare(...);
    /* do stuff with the handle */
  }
  </code></pre>
  
  <p>will the prepare() statement be cached by PDO so that it's quickly retrieved the second, third etc. times?  Or is it better to do it myself, e.g.</p>
  
  <pre><code>function foo() {
    static $handle = null;
    if (!$handle) {
      $handle = PDO::prepare(...);
    }
    /* do stuff with the handle */
  }
  </code></pre>