我一直在寻找这个答案,但没有找到任何地方。是调用PDO ::准备()缓存,或者我应该缓存结果自己,也就是说,如果我做了以下PHP PDO缓存
function foo() {
$handle = PDO::prepare(...);
/* do stuff with the handle */
}
将准备()语句由PDO被缓存,这样它的快速检索第二,第三次等?或者我自己做得更好,例如
function foo() {
static $handle = null;
if (!$handle) {
$handle = PDO::prepare(...);
}
/* do stuff with the handle */
}