mikebronner / laravel-model-caching

Eloquent model-caching made easy.
MIT License
2.25k stars 212 forks source link

Clear all data in model, not only by one ID #311

Closed PooX closed 4 years ago

PooX commented 4 years ago

Describe the bug I dont' think that this is bug, but can't find solution. I have some data in models, like Posts by User ID, so when i add new post on User 1, every other user cache is cleared. Is there possible to delete for only specific model id or something like this?

I have some sync function for some user, where i visit /user/1/sync

Then there is command Artisan::call('modelCache:clear', ['--model' => "App\Posts"]);

Is possible when i add posts, to only update custom model.

Environment

mikebronner commented 4 years ago

@PooX I don't understand your question. From what you are describing, you are already clearing the cache for a given model. Normally you don't need to manually clear the cache at all, unless you are having other issues or are running into edge-cases that this package currently doesn't support.

If you are asking to only clear the cache for User model with id of 1, then no, that is not possible with this package, at least not at this time. Sorry. :(

Let me know if this answered your questions.

PooX commented 4 years ago

If you are asking to only clear the cache for User model with id of 1, then no, that is not possible with this package, at least not at this time. Sorry. :( Let me know if this answered your questions.

Yes, that is what i ask. So bad for me, but it's ok. Thank you for answer. :)