@@ -56,7 +56,7 @@ public function flushCache(array $tags = [])
56
56
57
57
$ this ->cache ($ tags )->flush ();
58
58
59
- [$ cacheCooldown, $ invalidatedAt , $ savedAt ] = $ this ->getModelCacheCooldown ($ this );
59
+ [$ cacheCooldown ] = $ this ->getModelCacheCooldown ($ this );
60
60
61
61
if ($ cacheCooldown ) {
62
62
$ cachePrefix = "genealabs:laravel-model-caching: "
@@ -73,6 +73,14 @@ public function flushCache(array $tags = [])
73
73
}
74
74
}
75
75
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
+
76
84
protected function makeCacheKey (
77
85
array $ columns = ['* ' ],
78
86
$ idColumn = null ,
@@ -96,10 +104,7 @@ protected function makeCacheTags() : array
96
104
97
105
protected function getModelCacheCooldown (Model $ instance )
98
106
{
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 ();
103
108
$ modelClassName = get_class ($ instance );
104
109
105
110
$ cacheCooldown = $ instance
@@ -135,10 +140,7 @@ protected function checkCooldownAndRemoveIfExpired(Model $instance)
135
140
return ;
136
141
}
137
142
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 ();
142
144
$ modelClassName = get_class ($ instance );
143
145
144
146
$ instance
0 commit comments