Issue: Model Cache Not Updating After Update/Delete #515
Closed
mattscicluna2
started this conversation in
General
Replies: 1 comment 3 replies
-
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. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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!
Beta Was this translation helpful? Give feedback.
All reactions