-
Notifications
You must be signed in to change notification settings - Fork 225
Cache does not flush in deleting function of Model #173
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
Comments
@andersonpem You should not have to call the artisan flush method. The package manages flushing on its own when you delete relationships and models. I would recommend removing those two lines and trying again. And please report the complete stack trace (you only reported from step #8 onwards), and don't forget to put the stack trace in the code back-ticks so that it is not formatted. Keep in mind:
Could you also provide the query that created the |
Hello Mike. I made some updates to the issue. Please let me know if you need something else. |
@andersonpem Could you provide the line section before #0 in the stack trace as well? The stack trace usually starts with a timestamp. I don't see any issues with the query that would cause concern. Everything should be working. What cache driver are you using? |
I'm using Redis. I don't have access to my computer right now. I post the information you asked as soon as I can :) |
After thoroughly checking the code, I think I found the problem. Spoiler: it wasn't the code. |
@andersonpem Thanks for following up. I'll close this for now, but if you find out more, please do re-open and follow up here. :) |
Describe the bug
Hi. Good night. Firstly, thanks for the great package. It really is handy.
I'm working on a menu class. Before deleting the current model the class checks for any relationships and deletes them.
After all the deletion is complete the cache is supposed to be flushed automatically. However I still get the old results if I refresh a page which queries the model.
Eloquent Query
The relationship in MenuItem is a parent-children relationship with rows of the same table.
The function:
If I refresh the page where I'm seeing the actual list I still see the old items and no query is executed according to Debugbar. When the cache is flushed the queries are re-executed
In the case of this very image, the "About" section was supposed to disappear. If I go to the terminal and do the same command, then it runs normally.
And what's interesting is that if I check for the deletion of the models they were indeed deleted.
Is this maybe a scope problem?
Stack Trace
Environment
The text was updated successfully, but these errors were encountered: