From 1cc8669295a3f77fa1006617b6e47d27d0702d12 Mon Sep 17 00:00:00 2001 From: rennokki Date: Mon, 2 Dec 2019 09:35:47 +0200 Subject: [PATCH 1/5] Set avoidCache to false on cacheFor. [skip ci] --- src/Traits/QueryCacheable.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Traits/QueryCacheable.php b/src/Traits/QueryCacheable.php index f37b5be..1a61bfe 100644 --- a/src/Traits/QueryCacheable.php +++ b/src/Traits/QueryCacheable.php @@ -21,6 +21,7 @@ protected function newBaseQueryBuilder() if ($this->cacheFor) { $builder->cacheFor($this->cacheFor); + $this->avoidCache = false; } if ($this->cacheTags) { From 84f96afd70ec72458ade7a16c77e4471ddc6d5da Mon Sep 17 00:00:00 2001 From: rennokki Date: Mon, 2 Dec 2019 09:36:05 +0200 Subject: [PATCH 2/5] Avoid cache by default --- src/Query/Builder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Query/Builder.php b/src/Query/Builder.php index 4b1f23c..06dc6ca 100644 --- a/src/Query/Builder.php +++ b/src/Query/Builder.php @@ -51,7 +51,7 @@ class Builder extends BaseBuilder * * @var bool */ - protected $avoidCache = false; + protected $avoidCache = true; /** * {@inheritdoc} From ec6585c3521e97a2da270ed0e975d379e922a764 Mon Sep 17 00:00:00 2001 From: rennokki Date: Mon, 2 Dec 2019 09:40:12 +0200 Subject: [PATCH 3/5] Fix typo --- src/Traits/QueryCacheable.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Traits/QueryCacheable.php b/src/Traits/QueryCacheable.php index 1a61bfe..53efd99 100644 --- a/src/Traits/QueryCacheable.php +++ b/src/Traits/QueryCacheable.php @@ -21,7 +21,7 @@ protected function newBaseQueryBuilder() if ($this->cacheFor) { $builder->cacheFor($this->cacheFor); - $this->avoidCache = false; + $builder->avoidCache = false; } if ($this->cacheTags) { From 7470c641ba0796a10033178de93683c48fb320f1 Mon Sep 17 00:00:00 2001 From: rennokki Date: Mon, 2 Dec 2019 09:45:54 +0200 Subject: [PATCH 4/5] Moved avoidCache to the scope [skip ci] --- src/Traits/QueryCacheable.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Traits/QueryCacheable.php b/src/Traits/QueryCacheable.php index 53efd99..f37b5be 100644 --- a/src/Traits/QueryCacheable.php +++ b/src/Traits/QueryCacheable.php @@ -21,7 +21,6 @@ protected function newBaseQueryBuilder() if ($this->cacheFor) { $builder->cacheFor($this->cacheFor); - $builder->avoidCache = false; } if ($this->cacheTags) { From 03382cbfc96214a2ddea6039712198da9f72ed59 Mon Sep 17 00:00:00 2001 From: rennokki Date: Mon, 2 Dec 2019 09:46:06 +0200 Subject: [PATCH 5/5] Moved avoidCache --- src/Query/Builder.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Query/Builder.php b/src/Query/Builder.php index 06dc6ca..24c4408 100644 --- a/src/Query/Builder.php +++ b/src/Query/Builder.php @@ -227,6 +227,7 @@ protected function getCache() public function cacheFor($time) { $this->cacheTime = $time; + $this->avoidCache = false; return $this; }