So I guess you're suggesting something like:

<CFIF NOT ISDEFINED("Application.Initialized")>
<CFSET APPLICATION.INITIALIZED = 1>

<CFQUERY NAME="Request.qGetHeadings" DATASOURCE="#request.DSN#" 
USERNAME="#request.USER#" PASSWORD="#request.PASS#" 
CACHEDWITHIN="#CreateTimeSpan(0,12,0,0)#">
SELECT Class_ID,Class_Name,Pages
FROM YellowPages (nolock)
WHERE Class_Name LIKE '#request.alpha#%'
ORDER BY Class_Name
</CFQUERY>

<CFLOCK SCOPE="APPLICATION" TIMEOUT="20" TYPE="EXCLUSIVE">
<CFSET APPLICATION.qGETHEADINGS = DUPLICATE(REQUEST.qGETHEADINGS)>
</CFLOCK>

</CFIF>

My question is that I have 26 like this.  One for A, B, C, etc,
for #request.alpha#

Will APPLICATION.qGETHEADINGS cache the datasets?  I would guess not.

OR to cache the query do I have loop over 26 values of #request.alpha# 
using the following (contrary to Allaire's Best Practices recommendation)?

<CFIF NOT ISDEFINED("Application.Initialized")>
<CFSET APPLICATION.INITIALIZED = 1>

<CFLOOP starts here...

<CFLOCK SCOPE="APPLICATION" TIMEOUT="100" TYPE="EXCLUSIVE">
<CFQUERY NAME="Application.qGetHeadings" DATASOURCE="#request.DSN#" 
USERNAME="#request.USER#" PASSWORD="#request.PASS#" 
CACHEDWITHIN="#CreateTimeSpan(0,12,0,0)#">
SELECT Class_ID,Class_Name,Pages
FROM YellowPages (nolock)
WHERE Class_Name LIKE '#request.alpha#%'
ORDER BY Class_Name
</CFQUERY>
</CFLOCK>

</CFLOOP>

</CFIF>

best,  paul

At 04:07 PM 9/27/00 +0100, you wrote:
>You could just as easily set them all as request scope, but that would mean
>that every user on your site would use a piece of the memory on your server
>and use the server *everytime* they hit the application.cfm to set those
>variables.  If you use a CFIF that checks the status of a key application
>variable around your CFSETs then all you do it hit the server everyone once
>in a while and use one little bit of memory for the global variables.

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

Reply via email to