Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redis Cache Tags unable to flush #47903

Closed
jhemmmm opened this issue Jul 31, 2023 · 7 comments
Closed

Redis Cache Tags unable to flush #47903

jhemmmm opened this issue Jul 31, 2023 · 7 comments

Comments

@jhemmmm
Copy link

jhemmmm commented Jul 31, 2023

Laravel Version

10.16.1

PHP Version

8.2.8

Database Driver & Version

mysql Ver 15.1 Distrib 10.7.8-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper

Description

Hello,

In production, the

Cache::tags('TAGS')->flush();

It only works after a few days and then stopped working completely.

Cache::tags('TAGS')->get(cache_key(['TAGS' => true, 'PAGE' => 1, 'SORT' => 'newest']));
= Illuminate\Pagination\LengthAwarePaginator {#7281
    +onEachSide: 3,
  }

> Cache::tags('TAGS')->flush();
= true

> Cache::tags('TAGS')->get(cache_key(['TAGS' => true, 'PAGE' => 1, 'SORT' => 'newest']));
= Illuminate\Pagination\LengthAwarePaginator {#8029
    +onEachSide: 3,
  }

> Cache::tags('TAGS')->forget(cache_key(['TAGS' => true, 'PAGE' => 1, 'SORT' => 'newest']));
= true

> Cache::tags('TAGS')->get(cache_key(['TAGS' => true, 'PAGE' => 1, 'SORT' => 'newest']));
= null

I was under the expression that it could be the flush function that isn't working so I tried doing the forget function, as expected, it works just fine, but the flush isn't working.

@crynobone
Copy link
Member

Hey there,

While this may be a legitimate issue, can you first try posting your problem or question on one of the support channels below? If this issue can be definitively identified as a bug, feel free to open up a new issue with a link to the original one and we'll gladly help you out.

Thanks!

@leo108
Copy link
Contributor

leo108 commented Aug 8, 2023

Same issue, it's very hard to reproduce but causing issues in our production environment.

@jhemmmm
Copy link
Author

jhemmmm commented Aug 8, 2023

Same issue, it's very hard to reproduce but causing issues in our production environment.

I recommend using this:
https://github.com/swayok/alternative-laravel-cache
https://laravel.com/docs/10.x/cache#pruning-stale-cache-tags
And a maximum of 1 hour of cache. That did fix the problem.

@indigoram89
Copy link

Had the same problem in production for long time. We removed cache:prune-stale-tags command from Console/Kernel.php and it works Ok for these days.

@jhemmmm
Copy link
Author

jhemmmm commented Sep 11, 2023

Had the same problem in production for long time. We removed cache:prune-stale-tags command from Console/Kernel.php and it works Ok for these days.

I wasn't even using that before but still having the same issue.

After I used the library I mentioned and added that command, the bug has stopped.

@MartySVK
Copy link

MartySVK commented Nov 8, 2023

Don't understand why this issue was closed. Redis cache is totally broken in Laravel 10

@jhemmmm
Copy link
Author

jhemmmm commented Nov 8, 2023

Don't understand why this issue was closed. Redis cache is totally broken in Laravel 10
They just really don't care that much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants