post = $post; } /** * Execute the console command. * * @return mixed */ public function handle() { $this->line("开始删除内容最火评论缓存"); $count = $this->post->withTrashed()->count(); $bar = $this->output->createProgressBar($count); $this->post->withTrashed()->chunk(100, function ($posts) use ($bar){ foreach($posts as $post){ Redis::DEL('post_new_comment_'.$post->id); $bar->advance(); } usleep(50000); }); $bar->finish(); $this->line("\n删除内容最火评论缓存结束"); } }