Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit da53fcc

Browse files
Ensure isCacheable in checkCooldownAndFlushAfterPersisting (#458)
1 parent 19bcdf2 commit da53fcc

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

‎src/Traits/Caching.php‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,10 @@ protected function checkCooldownAndRemoveIfExpired(Model $instance)
263263

264264
protected function checkCooldownAndFlushAfterPersisting(Model $instance, string $relationship = "")
265265
{
266+
if (!$this->isCachable()) {
267+
return;
268+
}
269+
266270
[$cacheCooldown, $invalidatedAt] = $instance->getModelCacheCooldown($instance);
267271

268272
if (! $cacheCooldown) {
@@ -295,6 +299,10 @@ public function isCachable() : bool
295299
$isCacheDisabled = ! Container::getInstance()
296300
->make("config")
297301
->get("laravel-model-caching.enabled");
302+
if ($isCacheDisabled) {
303+
return false;
304+
}
305+
298306
$allRelationshipsAreCachable = true;
299307

300308
if (
@@ -327,7 +335,6 @@ public function isCachable() : bool
327335
}
328336

329337
return $this->isCachable
330-
&& ! $isCacheDisabled
331338
&& $allRelationshipsAreCachable;
332339
}
333340

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /