@@ -56,7 +56,7 @@ public function flushCache(array $tags = [])
5656
5757 $ this ->cache ($ tags )->flush ();
5858
59- [$ cacheCooldown, $ invalidatedAt , $ savedAt ] = $ this ->getModelCacheCooldown ($ this );
59+ [$ cacheCooldown ] = $ this ->getModelCacheCooldown ($ this );
6060
6161 if ($ cacheCooldown ) {
6262 $ cachePrefix = "genealabs:laravel-model-caching: "
@@ -73,6 +73,14 @@ public function flushCache(array $tags = [])
7373 }
7474 }
7575
76+ protected function getCachePrefix () : string
77+ {
78+ return "genealabs:laravel-model-caching: "
79+ . (config ('laravel-model-caching.cache-prefix ' )
80+ ? config ('laravel-model-caching.cache-prefix ' , '' ) . ": "
81+ : "" );
82+ }
83+
7684 protected function makeCacheKey (
7785 array $ columns = ['* ' ],
7886 $ idColumn = null ,
@@ -96,10 +104,7 @@ protected function makeCacheTags() : array
96104
97105 protected function getModelCacheCooldown (Model $ instance )
98106 {
99- $ cachePrefix = "genealabs:laravel-model-caching: "
100- . (config ('laravel-model-caching.cache-prefix ' )
101- ? config ('laravel-model-caching.cache-prefix ' , '' ) . ": "
102- : "" );
107+ $ cachePrefix = $ this ->getCachePrefix ();
103108 $ modelClassName = get_class ($ instance );
104109
105110 $ cacheCooldown = $ instance
@@ -135,10 +140,7 @@ protected function checkCooldownAndRemoveIfExpired(Model $instance)
135140 return ;
136141 }
137142
138- $ cachePrefix = "genealabs:laravel-model-caching: "
139- . (config ('laravel-model-caching.cache-prefix ' )
140- ? config ('laravel-model-caching.cache-prefix ' , '' ) . ": "
141- : "" );
143+ $ cachePrefix = $ this ->getCachePrefix ();
142144 $ modelClassName = get_class ($ instance );
143145
144146 $ instance
0 commit comments