public function findByPk($pk, $condition = '', $params = array()) { if (empty($condition) && empty($params)) { if (array_key_exists($pk, $this->findByPkCache)) { return $this->findByPkCache[$pk]; } else { $result = parent::findByPk($pk, $condition, $params); if (!is_null($result)) { $this->findByPkCache[$pk] = $result; } return $result; } } return parent::findByPk($pk, $condition, $params); }