I am using Redis
to cache queries/routes in Laravel 5.2.
I have 3 environments running on the same web server i.e "production", "staging", and "development."
For each environment I set a different cache prefix
value to allow me to link the cache to different environment.
In the config/cache.php
file I changed the line
'prefix' => 'laravel',
To
'prefix' => ENV('CACHE_PREFIX', 'laravel'),
Then in my .env
file, I added the prefix for each environment like this
For Dev
CACHE_PREFIX="LaravelDev"
For Staging
CACHE_PREFIX="LaravelStaging"
For Production
CACHE_PREFIX="LaravelProduction"
I know I can clear the cache from the command line like this
php artisan cache:clear
But the code above will clear the cache for all of my environments.
I only want to clear the cache for "LaravelDev" only and leave alone "LaravelStaging" and "LaravelProduction"
How can I clear the cache for a specific environment?