LoginSignup
1
0

More than 1 year has passed since last update.

【Laravel5.5】キャッシュクリアコマンドと、まとめて実行する方法

Last updated at Posted at 2021-01-23

Laravel5.5使用時の例です。
ファイルの変更を反映した後、実行しておきたいキャッシュクリアコマンド。

php artisan cache:clear

→「storage/framework/cache/data」内のキャッシュデータを削除する。

php artisan view:clear

→「storage/framework/views」内に全ビューのキャッシュデータを削除する。

php artisan config:clear

→「config」ディレクトリのファイルの更新内容が反映されるようになる。

php artisan route:clear

→「bootstrap/cache/routes.php」のRouteのキャッシュデータを削除する。

※ 各コマンドで何しているかは、
https://blog.capilano-fw.com/?p=768 より引用しました。
こちらのサイトにはとてもお世話になっております。感謝永遠に。。

まとめて実行するには…

&&で繋げると順番に実行可能。

php artisan cache:clear && php artisan view:clear && php artisan config:clear && php artisan route:clear

systemディレクトリ直下にシェルスクリプトを作成する方法もある。

clear_cache.sh
php artisan cache:clear
php artisan view:clear
php artisan config:clear
php artisan route:clear

//最後に改行を入れる

上記では「clear_cache.sh」というファイル名にしているので、
systemディレクトリにいる状態で、
下記のコマンドでまとめて実行することができる。

sh clear_cache.sh

楽。よき。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0