Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Issue: Model Cache Not Updating After Update/Delete #514

Closed
mattscicluna2 opened this issue Mar 12, 2025 · 1 comment
Closed

Issue: Model Cache Not Updating After Update/Delete #514

mattscicluna2 opened this issue Mar 12, 2025 · 1 comment

Comments

@mattscicluna2
Copy link

Description:
I recently upgraded my Laravel project from v9 to v11, which required updating this package to the latest compatible version, v12.0.2. I also tested v0.13.0 on Laravel 10 and encountered the same issue.

The problem is that while the package successfully writes data into Redis, it does not update the cache when a model is updated or deleted. The changes are only reflected after running:

php artisan cache:clear

Steps to Reproduce:
Update a model record using Eloquent.
Check Redis – the old data remains.
Delete a model record.
Check Redis – the deleted data still exists.
Run php artisan cache:clear, and only then does the cache update properly.
Expected Behavior:
The cache should automatically refresh when a model is updated or deleted, without requiring a manual cache:clear.

Environment Details:
Laravel Version: 11.x (also tested on 10.x)
Package Version: v12.0.2 (also tested on 0.13.0 with Laravel 10)
Cache Driver: Redis
Any guidance or fixes would be greatly appreciated!

@mikebronner
Copy link
Owner

Hi @mattscicluna2 please provide an example of your model and the query being ran. It sounds like the model doesn't have the Cachable trait or the query method is not supported. I'm moving this to a discussion for now until we can drill further into this and positively identify it as a bug.

Repository owner locked and limited conversation to collaborators Mar 12, 2025
@mikebronner mikebronner converted this issue into discussion #515 Mar 12, 2025

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants