Skip to content
This repository has been archived by the owner on Sep 27, 2021. It is now read-only.

Commit

Permalink
Return a value from prefetch if result is false
Browse files Browse the repository at this point in the history
  • Loading branch information
qurben committed May 22, 2019
1 parent 7319ae4 commit 46e90a1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/CachedPersistenceModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ protected function cacheResult($result_set, $memcache = false) {
* @param string $order_by ORDER BY
* @param int $limit max amount of results
* @param int $start results from index
* @return array
* @return array|boolean
*/
public function prefetch(
$criteria = null,
Expand Down Expand Up @@ -211,9 +211,12 @@ public function prefetch(
$start
);
}
if ($result !== false) {
$cached = $this->cacheResult($result, false);

if ($result === false) {
return $result;
}

$cached = $this->cacheResult($result, false);
if ($result instanceof PDOStatement) {
$this->setCache($key, $cached, $this->memcache_prefetch);
}
Expand Down

0 comments on commit 46e90a1

Please sign in to comment.