File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments