/**
  * @param QueryInterface $query
  * @return array
  */
 public function fetch(QueryInterface $query)
 {
     $query->checkReplacements();
     $executed = $this->execute($query);
     $data = $executed->fetchAll();
     if ($executed instanceof ResultCacheStatement) {
         $this->hitsContainer->addSave($query->getPlainQuery(), serialize($data));
     }
     if ($executed instanceof ArrayStatement) {
         $this->hitsContainer->addRead($query->getPlainQuery(), serialize($data));
     }
     $executed->closeCursor();
     return $data;
 }
 /**
  * @param Request $request A Request instance
  * @param Response $response A Response instance
  * @param \Exception $exception An Exception instance
  *
  * @api
  */
 public function collect(Request $request, Response $response, \Exception $exception = null)
 {
     $this->data['cache_saves'] = $this->hitsContainer->getSaves();
     $this->data['cache_read'] = $this->hitsContainer->getReads();
 }