Skip to content

Commit

Permalink
Merge pull request renoki-co#16 from shinsenter/dont_cache_on_write
Browse files Browse the repository at this point in the history
Do not cache when using the write pdo for query
  • Loading branch information
rennokki authored Apr 2, 2020
2 parents afe4c80 + 69d59e8 commit 1895fc6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,18 @@ public function get($columns = ['*'])

return parent::get($columns);
}

/**
* {@inheritdoc}
*/
public function useWritePdo()
{
// Do not cache when using the write pdo for query.
$this->dontCache();

// Call parent method
parent::useWritePdo();

return $this;
}
}
2 changes: 2 additions & 0 deletions src/Traits/QueryCacheable.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ protected function newBaseQueryBuilder()

if ($this->cacheFor) {
$builder->cacheFor($this->cacheFor);
} else {
$builder->dontCache();
}

if ($this->cacheTags) {
Expand Down

0 comments on commit 1895fc6

Please sign in to comment.