Teoman Tıngır
Teoman Tıngır

Reputation: 2901

Laravel - Can't change default cache driver

I'm trying to change cache driver from file to redis or apc, but everytime when I said dd(\Cache::getDefaultDriver()); it gives me that "file" as default cache driver.

I cleared config and stored cache, but it still continue..

php artisan config:cache
php artisan cache:clear

in my config/cache.php

'default' => env('CACHE_DRIVER', 'redis'),

What should I do ? I'm working on local and my laravel version is 5.6

Upvotes: 2

Views: 4506

Answers (2)

Akbar Soft
Akbar Soft

Reputation: 1066

1) composer require predis/predis 2) in config/database.php paste these codes below..

'redis' => [

    'client' => 'predis',

    'default' => [
        'host' => env('REDIS_HOST', 'localhost'),
        'password' => env('REDIS_PASSWORD', null),
        'port' => env('REDIS_PORT', 6379),
        'database' => 0,
    ],

],

3) CACHE_DRIVER=redis in .env file

Upvotes: 2

parastoo
parastoo

Reputation: 2469

please change

CACHE_DRIVER = redis

in .env

to redis and again run php artisan serve

Upvotes: 4

Related Questions