Skip to content

Commit 1895fc6

Browse files
authored
Merge pull request #16 from shinsenter/dont_cache_on_write
Do not cache when using the write pdo for query
2 parents afe4c80 + 69d59e8 commit 1895fc6

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/Query/Builder.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,18 @@ public function get($columns = ['*'])
2121

2222
return parent::get($columns);
2323
}
24+
25+
/**
26+
* {@inheritdoc}
27+
*/
28+
public function useWritePdo()
29+
{
30+
// Do not cache when using the write pdo for query.
31+
$this->dontCache();
32+
33+
// Call parent method
34+
parent::useWritePdo();
35+
36+
return $this;
37+
}
2438
}

src/Traits/QueryCacheable.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ protected function newBaseQueryBuilder()
2121

2222
if ($this->cacheFor) {
2323
$builder->cacheFor($this->cacheFor);
24+
} else {
25+
$builder->dontCache();
2426
}
2527

2628
if ($this->cacheTags) {

0 commit comments

Comments
 (0)