If the QUERY result changes (the result) the CACHE changes. This is the point. If the query has NOT changed CF will use what is stored. Otherwise it re-requests the data from the database server.
ColdFusion is NOT a database server. Your database returns a result to ColdFusion based on what CF request. If the database server itself says "the results are different now" than obviously the result given to CF is now changed. Hence a new QUERY.RESULT and a NEW AND UPDATED cache. Get it? Peter Tilbrook Managing Director, ColdGen Internet Solutions Professional Adobe ColdFusion 9 Application Development President, ACT and Region ColdFusion Users Group PO Box 2247 Queanbeyan, NSW, 2620 AUSTRALIA Tel: +61-2-6284-2727 Mob: +61-2-0457-449-016 Email Address: pe...@coldgen.com WWW: http://www.coldgen.com/ ABN: 80 826 226 128 NOTICE: This email remains the property of ColdGen Internet Solutions. Confidentiality and legal privilege associated with information transmitted in this email, including any attachments, are not waived or lost by reason of its mistaken delivery to you. If you have received this email in error, please destroy the document and notify the sender immediately by telephone or by email to in...@coldgen.com. Do not remove this notice from this email. Emails belong in computers, trees belong in forests; if you must print this, do it on recycled paper. -----Original Message----- From: cfaussie@googlegroups.com [mailto:cfaussie@googlegroups.com] On Behalf Of Andrew Sent: Tuesday, 21 June 2011 5:37 PM To: cfaussie Subject: [cfaussie] Re: cfquery cachedwithin Thanks guys. What's confusing me is that the query is *not* dynamic. The underlying data *may* change in the meantime (it's a count - and we're prepared to accept the discrepancy), but the query itself accepts no parameters and the sql will be identical each time it's called. That's what confuses me, because I was under the impression that under these conditions it should "stay cached", and it doesn't seem to be. Doing a <cfdump> shows cached = true most of the time, but every now and then it shows cached = false. I'm thinking of just putting the value in a variables and caching it with <cfcache>, but I'd really like to understand why it's not working as expected... Andrew. On Jun 21, 5:15 pm, ColdGen Internet Solutions <coldgen.internet.soluti...@gmail.com> wrote: > Query caching is great for things that you KNOW won't change for ages, > eg OZ PostCode/Suburbs you can safely cache for 24hours but still a > pain in the butt to get source file from AusPost but as an example. > > Not every query needs to or even should be cached. > > Basic rule of thumb is if SQL or whatever database server you use > (what are you using? I use 3 iterations of SQL Server) changes between > CF and the database server - expecting a different and not the same > result (same result use the cached result) a new query will be made > and THAT will then be cached. > > Peter Tilbrook > Managing Director, ColdGen Internet Solutions Professional Adobe > ColdFusion 9 Application Development President, ACT and Region > ColdFusion Users Group PO Box 2247 Queanbeyan, NSW, 2620 AUSTRALIA > > Tel: +61-2-6284-2727 > Mob: +61-2-0457-449-016 > > Email Address: pe...@coldgen.com > WWW:http://www.coldgen.com/ > > ABN: 80 826 226 128 > > On 21 June 2011 17:08, Paul Kukiel <kuki...@gmail.com> wrote: > > > > > Do you use ColdFire? ( now works with FF 4 ) You can watch all > > queries on each page hit and it will tell you if its cached or not. > > You can also watch this with " Enable Request Debugging Output " > > turend on although it will mess up your HTML in some cases. > > That way you can prove if its being cached or not. > > Paul. > > On Tue, Jun 21, 2011 at 5:02 PM, Andrew <am2...@gmail.com> wrote: > > >> Hi, > > >> A colleague has asked me to investigate some code that he claims > >> used to cache, but at some point recently doesn't anymore. > > >> Sadly, I can't replicate the exact code / query here (I expect my > >> boss would have a fit if I did), but to "paraphrase" it, it's > >> something > >> like: > > >> <cfquery name="qCount" datasource="somedatasource" > >> cachedwithin="#CreateTimeSpan(0,5,0,0)#"> > >> .... > >> </cfquery> > > >> Please take my word for it that the query does not change, but it > >> DOES have a couple of nested selects (not sure that would be a factor?). > > >> I set up a test page, and it appears to remain cached for a couple > >> of minutes and then disappear from the cache. > > >> The CF Administrator is set to cache 100 queries, and looking at > >> the monitor it seems to flucuate between about 2 and 8 cached > >> queries in total, so I am pretty sure we aren't hitting the limit. > > >> So my question is - how can I debug this? I believe the > >> requirements specified in the doco are being meet, eg: > > >> "the current query must use the same SQL statement, data source, > >> query name, user name, and password" > > >> However, one possible thing I can think of is, what if there was > >> the same SQL statement being called with a different datasource. > >> Would that cause this one to be lost? Or would they both be cached > >> independently? Because this is a possibility, as we have a staging > >> instance on the same coldfusion instance. > > >> Hopefully that all makes sense...it's a bit hard to explain... > > >> Andrew. > > >> -- > >> You received this message because you are subscribed to the Google > >> Groups "cfaussie" group. > >> To post to this group, send email to cfaussie@googlegroups.com. > >> To unsubscribe from this group, send email to > >> cfaussie+unsubscr...@googlegroups.com. > >> For more options, visit this group at > >>http://groups.google.com/group/cfaussie?hl=en. > > > -- > > Paul Kukiel > > > -- > > You received this message because you are subscribed to the Google > > Groups "cfaussie" group. > > To post to this group, send email to cfaussie@googlegroups.com. > > To unsubscribe from this group, send email to > > cfaussie+unsubscr...@googlegroups.com. > > For more options, visit this group at > >http://groups.google.com/group/cfaussie?hl=en.- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "cfaussie" group. To post to this group, send email to cfaussie@googlegroups.com. To unsubscribe from this group, send email to cfaussie+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en. -- You received this message because you are subscribed to the Google Groups "cfaussie" group. To post to this group, send email to cfaussie@googlegroups.com. To unsubscribe from this group, send email to cfaussie+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en.