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.