/** * @param string $cacheKey * @param \PDOStatement $statement */ protected function _addCachedStmt($cacheKey, $statement) { if ($this->_maxPreparedStatements === null) { $this->_maxPreparedStatements = $this->_config()->getItem('max_prepared_statements', 10); } if ($this->_maxPreparedStatements > 0) { parent::_addCachedStmt($cacheKey, $statement); $connId = $this->_getConnectionId(); if (isset(self::$_stmtCache[$connId])) { while (count(self::$_stmtCache[$connId]) > $this->_maxPreparedStatements) { array_shift(self::$_stmtCache[$connId]); } } } }