ForceMan
ForceMan

Reputation: 25

Laravel cache driver

I use Laravel version 9 and use API requests in my routes. I wanted to configure RateLimiter in the RouteServiceProvider file, but it doesn't work when I use the .env setting CACHE_DRIVER=array.

But if I put CACHE_DRIVER=file, then RateLimiter works fine. But then after authorization I see the error "This cache store does not support tagging." If I reload the page, the error disappears.

Tell me pls what the problem is, so that both RateLimiter and CACHE_DRIVER=file work without this error when authorizing the user?

Thanks!

Upvotes: 0

Views: 2228

Answers (1)

Dwight
Dwight

Reputation: 12470

The array cache driver is an in-memory cache and is only live for the request it is used. Once the request is completed then that cache is effectively gone. As mentioned in a comment above it is generally used for the test environment.

You're best to use another cache driver for development - preferably the same as what you use in production. But failing that the file driver is the easiest fallback.

Upvotes: 5

Related Questions