I may have misunderstood the first question.  You could call the cached
queries by name because CF *does* cache by SQL (SQL must be *identical*
right down to the number of spaces).  However, if you ran this cfloop on a
page and immediately after it, tried to output the query, it would use the
last query run.

Sharon

-----Original Message-----
From: JF <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Friday, August 25, 2000 2:30 PM
Subject: Re: questions about "cachedwithin"


>That's not the behavior I've seen - CF is smart enough to look at the
>select criteria of a query and will reuse it based on the criteria, not the
>name.
>
>I wrote a site that used the same query name to dynamically build forms
>from a data dictionary, and each page (with different select criteria but
>the same query name) showed as a Cached Query with debugging turned on.
>
>...Jay
>
>At 10:53 AM 8/25/2000, you wrote:
>>You would have 10 cached queries, but because CF refers to queries by
name,
>>you can only use one of them (the last one executed.)  So you'll need to
>>change the name of the query for each loop:
>>
>><cfloop from="1" to="10" index="i">
>>     <cfquery name="qryName_#i#" datasource="#dsn#">
>>         SELECT field1
>>         FROM table
>>         WHERE field2 = '#i#'
>>     </cfquery>
>></cfloop>
>>
>>Sharon
>>
>>-----Original Message-----
>>From: Todd Ashworth <[EMAIL PROTECTED]>
>>To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
>>Date: Friday, August 25, 2000 12:58 PM
>>Subject: questions about "cachedwithin"
>>
>>
>> >To paraphrase the CFWACK:
>> >
>> >'The ColdFusion caching logic takes <cfif>, <cfloop>, and other dynamic
>> >structures in queries into account, ensuring that caching is safe to use
>> >within a dynamic environment.'
>> >
>> >OK .. Say I have
>> >
>> ><cfloop from="1" to="10" index="Variables.index">
>> >    <cfquery name="qryName" datasource="#Variables.DSN#"
>> >cachedwithin="#CreateTimespan(1,0,0,0)#">
>> >        SELECT field1
>> >        FROM table
>> >        WHERE field2 = '#Variables.index#'
>> >    </cfquery>
>> ></cfloop>
>> >
>> >I'm assuming in this scenario I will end up with 10 different cached
>>queries
>> >... or would all of the queries overwrite each other because they all
have
>> >the same name?
>> >
>> >Also, does anyone know how much overhead is associated with removing the
>> >oldest cached query from memory and replacing it with the newest when
the
>> >limit is reached?  I'm guessing even if it has to be done a lot, it's
still
>> >faster than than hitting the database for 15 rows of data, every single
>> >time.
>> >
>> >Todd Ashworth
>> >
>> >
>>
>---------------------------------------------------------------------------
>>---
>> >Archives: http://www.mail-archive.com/[email protected]/
>> >To Unsubscribe visit
>>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
>>send a message to [EMAIL PROTECTED] with 'unsubscribe' in
>>the body.
>>
>>--------------------------------------------------------------------------
----
>>Archives: http://www.mail-archive.com/[email protected]/
>>To Unsubscribe visit
>>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
>>send a message to [EMAIL PROTECTED] with 'unsubscribe' in
>>the body.
>
>---------------------------------------------------------------------------
---
>Archives: http://www.mail-archive.com/[email protected]/
>To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to