its not the template, its a) the name of the query and b) the contents (ie
the actual statement)

if the statement is different then its treated as a different query.

The following code proves this...

<cfscript>
myquery = querynew("col1");
for(i=1;i lte 10;i=i+1) {
        queryaddrow(myquery);
        querysetcell(myquery, "col1", i);
}
</cfscript>

<cfquery name="testquery" dbtype="query"
cachedwithin="#createtimespan(0,1,0,0)#">
SELECT col1 FROM myquery WHERE col1 <= 5
</cfquery>

<cfdump var="#testquery#">

<cfscript>
for(i=1;i lte 10;i=i+1) {
        querysetcell(myquery, "col1", 1, i);
}
</cfscript>

<cfquery name="testquery" dbtype="query"
cachedwithin="#createtimespan(0,1,0,0)#">
SELECT col1 AS column1 FROM myquery WHERE col1 <= 5
</cfquery>

<cfdump var="#testquery#">

> -----Original Message-----
> From: Russ 'Snake' Michaels [mailto:snake@;snakepit.net]
> Sent: 29 October 2002 15:16
> To: [EMAIL PROTECTED]
> Subject: [ cf-dev ] caching queries
> 
> 
> When caching queries, is it only the query anme query name 
> that needs to be
> the same, or is it also dependant on the template that called it.
> 
> for example, I have a custom tag that queries a database with 
> a bunch of
> passed params, including the cache period.
> I also called this tag elsewhere from a content editor, and sending a
> cachedwithin of "0", so effectively it should un-cache the query.
> But the query seems to remain cached even though I am setting a
> CreateTimeSpan(0,0,0,0)
> 
> e.g
> 
> in the site
> 
> <CF_SHOWCONTENT cachedwithin="2" container="container1" 
> username="whatever"
> password="whatever" datasource="whatever">
> 
> and form the admin
> 
> <CF_SHOWCONTENT cachedwithin="0" container="container1" 
> username="whatever"
> password="whatever" datasource="whatever">
> 
> and the query generated is thus
> 
> <cfquery name="contentItems_#replace(attributes.container,' 
> ','_','ALL')#"
> datasource="#attributes.DSN#" username="#attributes.username#"
> password="#attributes.password#"
> cachedwithin="#CreateTimeSpan(0,attributes.cachedwithin,0,0)#">
> select #attributes.rowcount# #attributes.columnlist# from contentItems
> where containerName = '#attributes.container#'
> </cfquery>
> <cfset "caller.#attributes.query#" =
> evaluate('contentItems_#replace(attributes.container,' 
> ','_','ALL')#')>
> 
> 
> -- 
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> For human help, e-mail: [EMAIL PROTECTED]
> 


-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to