What is Redis
Redis is a storage server that stores data in memory for very fast Read/Write transactions.
It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, geospatial indexes with radius queries and streams.
Read more about Redis.
composer require predis/predis
In order to configure Redis in Laravel, you can change these settings in
'redis' => [ 'cluster' => false, 'default' => [ 'host' => '127.0.0.1', 'port' => 6379, 'database' => 0, ], ],
If you want to manage these settings by .env file do the following.
'redis' => [ 'cluster' => false, 'default' => [ 'host' => env('REDIS_HOST', '127.0.0.1'), 'port' => env('REDIS_PORT', 6379), 'database' => env('REDIS_DATABASE', 0), ], ],
.env file add:
REDIS_HOST=127.0.0.1 REDIS_PORT=6379 REDIS_DATABASE=0
If you are using Laravel remember to run:
php artisan config:clear
And if you are using Lumen remember to add:
That’s it for configurations, enjoy!