Re: Problem:data retrieved from database are cached
AD7six wrote: > do you have 2 find calls in the same method? > > i.e do you have > > $Model->find > .. do something and maybe save > $Model->find > > ? > > If you do - set cacheQueries = false on the model at the beginning of > your action (or anywhere else appropriate) so that it doesn´t take the > result from memory for subsequent identical queries. That is, unless > you want to disable cache site wide, inwhich case nate's already shown > the way. > > HTH, > > AD7six Thanks for the replies. I think i will disable cache site wide. Besides I am calling a function that uses just one $Model->find in it and i have the problems mentioned. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Problem:data retrieved from database are cached
Zipman, I was having the same problem and determined it was the browser doing the caching. The only way I was able to overcome this was by adding "?ms=" + new Date().getTime()" to my action links. This is some javascript that simply tacks a unique timestamp to the link to ensure it is never cached. For example, I use AJAX to update a div in my page as follows: function viewClient(id) { new Ajax.Updater('data_client', '/myapp/clients/view/'+id+"?ms=" + new Date().getTime(), {asynchronous:true}); } I have not had an issue since implementing this. Hope it helps... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Problem:data retrieved from database are cached
do you have 2 find calls in the same method? i.e do you have $Model->find .. do something and maybe save $Model->find ? If you do - set cacheQueries = false on the model at the beginning of your action (or anywhere else appropriate) so that it doesn´t take the result from memory for subsequent identical queries. That is, unless you want to disable cache site wide, inwhich case nate's already shown the way. HTH, AD7six --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Problem:data retrieved from database are cached
Yes,that's the case. I get different results when i access a link than when i press F5. When i set /app/tmp/cache/models folder not to be writeable i have no problem. But even my browser( firefox) is the problem(I'm using a plugin through which I disable cache) how can i surpass this ,so that no cacheis used as regards models? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Problem:data retrieved from database are cached
Hi zipman, there's an undocumented "feature" that allows you to completely disable Cake's caching by adding this: define("DISABLE_CACHE", true); to app/config/core.php. However, this is only recommended in the most extreme unusual cases, as your application will take quite a performance hit for having to query the database for table descriptions on every request. However, it doesn't sound like table caching is your issue. It sounds more like an HTTP or browser cache thing. Cake 1.2 has a new controller method called disableCache() which will send the appropriate headers so that the browser does not cache your page. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Problem:data retrieved from database are cached
Hi zipman, are you sending cache headers with your files? If you get a different result when you access a link from when you press "F5" (or equivalent) surely that indicates that your browser is taking the page results from it's cache. So: what exactly are you doing ;), how can this be reproduced etc. Cheers, AD7six --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Problem:data retrieved from database are cached
Thanks for the reply. But what if I am in production level? (for me it doesn't work even when debug=1). Should i change the permissions for the folder models so that it is not writeable?(That works) Isn't there any property in any file, that doesn't allow cache for models? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Problem:data retrieved from database are cached
On 9/11/06, zipman <[EMAIL PROTECTED]> wrote: > > I have a model and I save some data through a form in the according > table. > The problem is that when I go to the link that regards the function > that retrieves > the data from the database and just presents them, the new data are not > shown, > even though they exist in the database. Only when i refresh the page > through > the browser the new data are shown. > > Is there any way to prevent this from happening,because it really is a > big problem? > Cranky Developer to the rescue! Make sure that you've set debug to 1 in app/config/core.php, and then delete the model cache files in /app/tmp/cache/models When debug is set to 0, it acts like it's in production. When you're building something, you always want to set debug to 1 or higher to make sure nothing gets cached. Hope that helps. -- Chris Hartjes "The greatest inefficiencies come from solving problems you will never have." -- Rasmus Lerdorf @TheBallpark - http://www.littlehart.net/attheballpark @TheKeyboard - http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---