mikebronner / laravel-model-caching

Eloquent model-caching made easy.
MIT License
2.26k stars 217 forks source link

how to clean cache only when data changes #178

Closed guangdao428 closed 5 years ago

guangdao428 commented 6 years ago

hi, i have two projects, front and admin, front to C and admin to B. front C use cache fully, but data in B often changes , so only want to clean cache where data changes in B, and query request in B do't use cache.skip the package, i don't know how to resolve it . please hope your reply. thanks.

mikebronner commented 6 years ago

Hi @guangdao428 , if I understand you correctly:

I'm not sure I follow where the issue lies, if you add the model-caching package only to one project, and not the other, does that not resolve your issue?

guangdao428 commented 5 years ago

thanks for your reply

yes i have 2 projects, but all of them use caching.2 projects share cached data.one can use caching data and update caching data.the another one hope only updating caching data, so that all data in cache changes.

hope your answer.

mikebronner commented 5 years ago

@guangdao428 Sorry, that scenario is not supported. The cache can only be updated from the same project.

One thing you could try overriding getCachePrefix() in the model on in your base class.