@@ -16,7 +16,7 @@ class CacheInvalidate extends Command implements Isolatable
1616 * @var string
1717 */
1818 protected $ signature = 'cache:invalidate ' .
19- '{stores? : Which stores to invalidate} ' ;
19+ '{stores? : Which stores to invalidate} ' ;
2020
2121 /**
2222 * The console command description.
@@ -45,21 +45,21 @@ class CacheInvalidate extends Command implements Isolatable
4545 */
4646 public function handle (): void
4747 {
48- $ stores = array_filter (explode (', ' , $ this ->argument ('stores ' )), fn ($ it ) => !empty ($ it ));
48+ $ stores = array_filter (explode (', ' , $ this ->argument ('stores ' )), fn ($ it ) => ! empty ($ it ));
4949 $ skipKeys = config ('koffinate.base.cache.skip_invalidate_keys ' );
5050
5151 $ cached = Cached::query ()
5252 ->select ('id ' , 'key ' , 'store ' , 'expires_at ' )
5353 ->where ('expires_at ' , '< ' , now ()->toAtomString ());
5454
55- if (!empty ($ skipKeys )) {
55+ if (! empty ($ skipKeys )) {
5656 is_array ($ skipKeys )
5757 ? $ cached ->whereNotIn ('key ' , $ skipKeys )
5858 : $ cached ->where ('key ' , '!= ' , $ skipKeys );
5959 }
6060
6161 $ fromStore = '' ;
62- if (!empty ($ stores )) {
62+ if (! empty ($ stores )) {
6363 $ fromStore = ' from store(s) ' .implode (', ' , $ stores );
6464
6565 if (count ($ stores ) === 1 ) {
@@ -72,18 +72,19 @@ public function handle(): void
7272 $ this ->components ->alert ('Invalidating caches ' .$ fromStore );
7373 $ this ->newLine ();
7474
75- if (!cacheIsHandling ()) {
75+ if (! cacheIsHandling ()) {
7676 $ this ->newLine ();
7777 $ this ->components ->warn ('THIS FEATURE WAS DISABLED ' );
7878 $ this ->components ->info ('you can enable this feature via config "koffinate.base.cache.handling" or set KFN_CACHE_HANDLING to true on env ' );
79+
7980 return ;
8081 }
8182
8283 Cached::$ catchEvents = false ;
8384
8485 $ cached ->chunkById (100 , function ($ caches ) {
8586 $ ids = [];
86- ++ self ::$ chunkIncr ;
87+ self ::$ chunkIncr++ ;
8788
8889 $ this ->components ->task ('invalidating cache # ' .static ::$ chunkIncr , function () use ($ caches , &$ ids ) {
8990 foreach ($ caches as $ cache ) {
@@ -94,7 +95,7 @@ public function handle(): void
9495 } elseif ($ cacheService ->forget ($ cache ->key )) {
9596 $ ids [] = $ cache ->id ;
9697 } else {
97- ++ static ::$ totalFailed ;
98+ static ::$ totalFailed++ ;
9899
99100 if ($ this ->output ->isVerbose ()) {
100101 self ::$ tempFailKeys [] = $ cache ->key ;
@@ -106,12 +107,11 @@ public function handle(): void
106107 }
107108 }
108109
109- if (!empty ($ ids )) {
110+ if (! empty ($ ids )) {
110111 try {
111112 if (Cached::query ()->whereIn ('id ' , $ ids )->delete ()) {
112113 self ::$ totalInvalidated += count ($ ids );
113114 }
114-
115115 } catch (\Throwable $ tr ) {
116116 $ context = [
117117 'message ' => $ tr ->getMessage (),
@@ -142,7 +142,7 @@ public function handle(): void
142142 self ::$ failKeys [] = self ::$ tempFailKeys ;
143143 self ::$ tempFailKeys = [];
144144 }
145- if (!empty (self ::$ failKeys )) {
145+ if (! empty (self ::$ failKeys )) {
146146 table (['failed key ' , 'failed key ' , 'failed key ' ], self ::$ failKeys );
147147 }
148148 }
0 commit comments