Naizam Sher Malik
Naizam Sher Malik

Reputation: 63

Laravel: Cache Store [predis] is not defined in Illuminate\Cache\CacheManager.php

I am using Laravel v5.7, whenever I am trying to post to login page using axios I am getting an 500 internal server error I somehow and in network tab in the console that specific file returns this:

{
    message: "Cache store [predis] is not defined.", exception: "InvalidArgumentException",…}
    exception: "InvalidArgumentException"
    file: "...\laravel\framework\src\Illuminate\Cache\CacheManager.php"
    line: 96
    message: "Cache store [predis] is not defined."
}

Upvotes: 1

Views: 7046

Answers (4)

tver3305
tver3305

Reputation: 8624

Had an issue with this using php 8.2.8 and laravel 10.10.1 after a major upgrade.

To resolve this, in config/cache.php I changed:

'stores' => [

 ...

 'redis' =>[
        'client' => 'redis',
    ],

 ...

]

to

'stores' => [

 ...

 'predis' =>[
        'client' => 'predis',
    ],

 ...

]

Which seemed to work.

Upvotes: 0

stackoverflow account
stackoverflow account

Reputation: 235

i had similar issue with following error :

message: "Cache store [Database] is not defined.", exception: "InvalidArgumentException",…}

to fix the error i did below

opened cache.php inside config and replaced

 'database' => [
       'driver' => 'database',
       'table' => 'cache',
       'connection' => null,
     ],

with

 'Database' => [
           'driver' => 'Database',
           'table' => 'cache',
           'connection' => null,
         ],

that solved the issue

Upvotes: 0

George Birnbaum
George Birnbaum

Reputation: 21

In my cache, no matter which cache store I set in my environment, this would ail, including when set to the default 'file'.

Double check that you have not change the name of your stores attribute in your config/Cache.php file.

I found I had change it unintentionally from stores to store.

If you're not using vcs in some fashion, Id recommend starting. I was able quickly find my issue with fresh eyes and a quick trip to my latest commits after find my local was broken, as well as, my new production.

Bad Commit

Upvotes: 2

Jignesh Joisar
Jignesh Joisar

Reputation: 15175

Before using Redis with Laravel, you will need to install the predis/predis package via Composer:

more detail

  composer require predis/predis

Upvotes: 0

Related Questions