Search code examples
phplaravelredis

Error : This cache store does not support tagging


I am working on a Laravel project and I am getting an error on my development machine. The same code is working fine on the production server. Here are the error details:

Error Message:

This cache store does not support tagging.

The error occurs in the following line of code:

public function getCache(): TaggedCache
{
    return \Cache::tags([Str::slug($this::class) . '-' . $this->id, $this::class]);
}

Here is my .env configuration for cache drivers on my development machine:

BROADCAST_DRIVER=null
CACHE_DRIVER=file
QUEUE_CONNECTION=redis
SESSION_DRIVER=file
SESSION_LIFETIME=120

And the .env configuration for cache drivers on the production machine:

BROADCAST_DRIVER=null
CACHE_DRIVER=redis
QUEUE_CONNECTION=redis
SESSION_DRIVER=redis
SESSION_LIFETIME=120

My Question: Is there a way to run the project on my development machine without making changes to the code? I understand that the issue is related to the CACHE_DRIVER being set to file on the development machine, but I don't have Redis installed locally.

I tried switching the cache driver to Redis, but this generated more errors since Redis is not installed on my local Windows machine.

Any suggestions on how to resolve this without needing to install Redis on my local machine? Would appreciate any help!


Solution

  • cache driver file doesn't support tagging.

    You can use

    CACHE_DRIVER=array
    

    Redis might work too but its little more work to setup Redis on widows machine