>- see footer for list info -<
Charlie Thanks for the reply.
Basically I have a function in a CFC which returns a query. It is very
basic something like:-
<cffunction name="getLatestNews" access="public" output="false"
returntype="query">
<cfset var qGetNews = "">
<cfquery datasource="#variables.sDSN#" name="qGetNews"
cachedwithin="#createTimeSpan(0, 1, 0, 0)#">
SELECT TOP 10 nNewsID AS nID, sNewsTitle AS sTitle,
sNewsDesc AS sDescription
FROM tbl_News
ORDER BY dPublishedDate DESC
</cfquery>
<cfreturn qGetNews>
</cffunction>
Now this will work for ages fine, then out of the blue the page that
calls it will suddenly start erroring on every request. The error will
say that qGetNews is undefined. I can see no coding reason why that
should ever occur, and as I mentioned before when this happens I set
cached queries to 0 to clear the cache in the administrator and then
set it back to its original number.
Thanks for the heads up on <cfobjectcache action = "clear"> I didn't
know about that, but I still have the issue as I cannot rely on the
automatic caching of CF.
On 1/26/06, Charlie Arehart <[EMAIL PROTECTED]> wrote:
> >- see footer for list info -<
> Simon, here are a few thoughts that may help. First, just to make sure we're
> on the same page, how is that you've
> concluded that it's "forgetting" the cached query? It shouldn't result in any
> error, just a refresh of the cached result
> because it's not there "now". There's no code-oriented or interface-oriented
> indication that this is happening. You say
> there's an error, but there should never be one.
>
> If you're finding that an expected query result is "undefined", it means that
> you've not run the CFQUERY that would
> define it. The cached query result feature (such as with cachedwithin) is
> different in that with it you should ALWAYS
> run the CFQUERY, but the cache mechanism does its thing in the background,
> determining whether to do a real DB I/O. If
> you're seeing the query being "undefined", I'd guess that some code is
> precluding the execution of the CFQUERY, which
> would seem a mistake.
>
> If instead this is really about cached results somehow being "lost" and a
> real DB I/O taking place when not expected,
> one way this could happen is by the number of cached results reaching the max
> number of cached queries. One thing to
> keep in mind is that a cached entry is kept not "per cached cfquery" but
> rather per set of unique sql generated within
> each cached cfquery (and also further per unique combination of username,
> password, and connectionstring).
>
> So one could have a lot more cached querie resultsets than they think (thus
> reaching the limit). There's no visual
> interface in CF to tell you how many cached queries you have, so it's a bit
> of a guessing game. (FWIW, BD's admin
> console does tell you that info, both the number of query results in the
> cache and the hit count against them.)
>
> Of course, another reason that the cached result could be "gone" is if the
> server was restarted. Since the cached
> templates are stored in memory (in CF and by default in BD), a restart of the
> server would lose those. Again, as a
> benefit, BlueDragon permits you to store the cached results on disk (to help
> solve this very problem, though obviously
> at some increased cost in disk I/O to get the cached result, but the point is
> that you'd do this if it was cheaper than
> doing real I/O to the DB).
>
> Finally, you also talk about fixing the problem by setting that max cached
> queries value to 0. Is that to clear the
> cache? Note that you can do that with the cfobjectcache (in both BD and CF):
> <cfobjectcache action = "clear">.
>
> Hope some (if not all of) that helps.
>
> Charlie Arehart
> CTO, New Atlanta Communications, makers of BlueDragon
> (678) 256-5395 [EMAIL PROTECTED]
> www.newatlanta.com/bluedragon/
>
>
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Simon Baynes
> > Sent: Thursday, January 26, 2006 5:29 AM
> > To: Coldfusion Development
> > Subject: [CF-Dev] ColdFusion Forgetting Cched Queries
> >
> > >- see footer for list info -<
> > We keep having this problem where ColdFusion seems to forget
> > a query cached with cachedwithin.
> >
> > I started getting this error that a query was undefined in my
> > CFC method. There was nothing wrong with the code, the only
> > way I could fix it was to set Maximum number of cached
> > queries to zero and then set it back to what it was before.
> >
> > This is really aggravating as I don't want to have to start
> > caching this query in a variable.
> >
> > Has anyone come across this and found a solution?
> >
> > Thanks.
> > --
> > Simon Baynes
> > www.simonbaynes.com
> > _______________________________________________
>
> _______________________________________________
>
> For details on ALL mailing lists and for joining or leaving lists, go to
> http://list.cfdeveloper.co.uk/mailman/listinfo
>
> --
> CFDeveloper Sponsors:-
> >- Hosting provided by www.cfmxhosting.co.uk -<
> >- Forum provided by www.fusetalk.com -<
> >- DHTML Menus provided by www.APYCOM.com -<
> >- Lists hosted by www.Gradwell.com -<
> >- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<
>
--
Simon Baynes
www.simonbaynes.com
_______________________________________________
For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo
--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<