I am a little confused on this, this is something I haven't dealt with
much... So forgive me if I don't understand.

Anyway I have done the following as a test.

<cf_timer>
 <CFQUERY NAME="ASTest" DATASOURCE="anything"
cachedwithin="#CreateTimeSpan(1,0,0,0)#">
  select * from bp_modules
 </CFQUERY>
</cf_timer>
<cf_timer>
 <CFQUERY NAME="ASTest" DATASOURCE="anything"
cachedwithin="#CreateTimeSpan(1,0,0,0)#">
  select * from bp_modules
 </CFQUERY>
</cf_timer>

The intersting thing is that, sometimes the second query returns the time it
should have executed other times it returns 0ms like you would expect a
cache to return.... This to me appears that either the logic of how it works
is wrong in what I think it does, or that there is a bug in the query
caching..... 



regards

Andrew Scott
Senior Cold Fusion Application Developer
ANZ eCommerce Centre
* Ph 9273 0693  
* [EMAIL PROTECTED]


-----Original Message-----
From: Dave Watts [mailto:[EMAIL PROTECTED]]
Sent: 25 November 2000 05:51
To: CF-Talk
Cc: '[EMAIL PROTECTED]'
Subject: RE: Caching Queries......


> > You can update cached queries by rerunning the query with a
> > CACHEDWITHIN or CACHEDAFTER attribute which would cause the 
> > query to expire immediately from the cache, then rerunning 
> > the query again with the desired cache time length.
> 
> Does this mean that on a specific page, if my query has
> CACHEDWITHIN="#CreateTimeSpan(0,0,30,0)#" that it'd re-create 
> the cache every time?
> 
> I thought that it'd only re-create the cache if the time has 
> expired... or am I getting things wrong...

I probably didn't state it clearly enough, that's all.

Let's say, on the home page of your application, you have a query which you
want to cache:

<cfquery name="qryNews" datasource="myapp"
cachedwithin="#CreateTimeSpan(1,0,0,0)#">
        SELECT N.News_ID,
                 N.News_Title
        FROM     News N
</cfquery>

Let's also say that you want to build an administrative interface that will
update the database, and clear the cached query. On your admin page, you
might have something like this:

<cfquery name="qryInsNewsItem" datasource="myapp">
        INSERT INTO News ...
</cfquery>
...
<cfquery name="qryNews" datasource="myapp"
cachedwithin="#CreateTimeSpan(0,0,0,0)#">
        SELECT N.News_ID,
                 N.News_Title
        FROM     News N
</cfquery>

Note the changed value for CACHEDWITHIN; this will delete the query from the
cache.

Then, the next time someone runs the home page, the query will reexecute and
will be recached. Or, if you wanted to avoid having that first user
inconvenienced, you could rerun the query yourself in the admin page with
the desired cache length.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to