Answer the question
In order to leave comments, you need to log in
How to set up caching in redis base on laravel?
Good afternoon. It is necessary to configure caching in Laravel in redis, and not in file. I installed radish on ubuntu, connected it to laravel. There is access to it from the code, the commands seem Redis::set('name', 'Taylor');
to work, then you can pull it out through Redis::get('name');
. In the terminal, radish keys t*
also shows these keys. In the config/cache.php file, I set 'default' => env('CACHE_DRIVER', 'redis'),
, but the data is not cached in the radish. As I understand it, they are cached in file. How to make it cached in radish? Through a facade Cache
I address if that.
Answer the question
In order to leave comments, you need to log in
In the .env file, you need to set the parameter at the root to a
CACHE_DRIVER=redis
Means
'default' => env('CACHE_DRIVER', 'redis')
that the value is taken from the environment file, and if it does not have such a key, then "redis" is used. After that, you need to run a command
php artisan optimize
to cache the config and environment variables.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question