jaynarayan's avatar

How to disable route cache during development. (without artisan optimize or cache : clear)

I don't want to use artisan optimize or clear: cache everyt ime I update my route files.

1 like
12 replies
tisuchi's avatar

@jaynarayan what if you just set a command that runs every certain time in your local development to clear cache?

jaynarayan's avatar

I am looking for disable caching. Is there any config option or other way?

Snapey's avatar
Snapey
Best Answer
Level 122

Just run artisan route:clear then leave it alone?

The routes are only cached when you run route:cache or optimize

You DO NOT need to mess with the cache drivers.

ONLY run route:cache or optimize as part of a production deployment script

10 likes
zvineyard's avatar

This is the correct answer. You just run php artisan route:clear and don't run php artisan route:cache again. If you run something like php artisan optimize it will re-cache your routes and you'll be back to where you started.

martinbean's avatar

@zvineyard The answer had already been marked as the best answer. Why did you need to reply a half-decade later saying as much?

chimit's avatar

I don't cache anything in my deployment script but routes are still cached for some reason. It's not documented anywhere.

Snapey's avatar

@ArturMamedov to disable the cache of routes,

  • DO NOT run php artisan route:cache and,
  • DO NOT run php artisan optimize

That is all you need to do.

Please or to participate in this conversation.