I
I
Ivan2020-09-18 08:43:29
Laravel
Ivan, 2020-09-18 08:43:29

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 CacheI address if that.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
LorgarAvrelian, 2020-09-24
@Djonson86

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 optimizeto cache the config and environment variables.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question