milesj / utility

[Deprecated] A CakePHP plugin for common utility classes.
MIT License
69 stars 24 forks source link

Enhancement + Bugfix #13

Closed Ali1 closed 11 years ago

Ali1 commented 11 years ago

Do you think this is useful? 'refreshCache'=>true in the Model->find options to grab data and update the cache at the same time.

milesj commented 11 years ago

Is checking for $_cached necessary in afterSave/afterDelete? That value is only cached for the current request, it's not the actual cache. If you force a refresh, the $_cached doesn't get set.

Ali1 commented 11 years ago

Firstly, the code is quite wrong I'll do another pull request momentarily.

In response to your question, I'm not sure what you mean. If you are referring to the deleteCache fix I submitted, then it's vitally important for the users not using cacheForceRefresh as any subsequent calls will be pulling old data. For example if someone was doing this:

function ajax_add{

getUserInfo logic to make sure he can add, proceed if he can User->save() delete the cache getUserInfo again to create the view

}

Ali1 commented 11 years ago

The unexpected outcome of the ajax_add situation above is what got me looking into this and then I decided it may be useful to to merge the last 2 processes together by using cacheForceRefresh.

milesj commented 11 years ago

Your change looks much better. I'll merge it when I get home later.

Ali1 commented 11 years ago

Fantastic

On 26 August 2013 18:35, Miles Johnson notifications@github.com wrote:

Your change looks much better. I'll merge it when I get home later.

— Reply to this email directly or view it on GitHubhttps://github.com/milesj/utility/pull/13#issuecomment-23280320 .