Hi Issac,
         I wasnt aware you need to lock everything with poniter scoping method
         to the application. I will test this anyways. Thanks
Joe

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Saturday, July 13, 2002 6:56 PM
To: CF-Talk
Subject: RE: RE: RE: Storing Queries in Application Scope


Hi Joe,

The reason for using the duplicate() function to copy data between the
request and application scopes is that creating a pointer to an application
scope query in the request scope, i.e.

<cflock scope="application" ...>
<cset request.myquery = application.myquery>
</cflock>

defeats the purpose of locking the application scope, since using the
pointer created in this example is still using the application scope
directly and thus creates the potential for server instability as a result
of application scope race conditions.

You can test this in CF 5 : in the CF Administrator turn on "require
locking" for the application scope, then use the above example and reference
the query outside the lock -- CF Server responds with an error message
indicating that the query contains variables in the application scope and
therefore cannot be referenced without an active lock.

In some cases it's better to simply reference individual variables in a
cflock since you can't manipulate the pointer to a simple value directly in
ColdFusion. If you need the entire contents of a query however, it's often
more efficient to go ahead and use the extra memory in the request scope and
let the CF Server's "garbage collection" handle freeing that memory up after
it finishes parsing the page.

Admittedly, I tend to err on the side of using more memory rather than going
to the db more often, etc... The reason I do this is because memory is
generally less expensive and easier to install than more processor speed,
etc. Especially lately -- anyone else notice the fire-sales on RAM this
year? :)

Isaac

www.turnkey.to
954-776-0046

Original Message -----------------------
Hi Issac,
        Your are right as well.."Right tool for the right Job". I wonder if it
would be a
        better solution to "NOT Duplicate the Structure" like
        <cflock type="readonly" timeout="20">
        <cfset Request.MyReqQuery=Application.MyQuery>  Note: No Duplicate or
StructCopy
        </cflock>
        There by only making referrence to Application scope like a POINTER since
        the data doesnt need to manipulated and only stored/displayed.
        Wouldnt this save memory space.. since u are not really creating a DEEP
Copy
        into the 2nd structure(Request)?
Joe
Certified Advanced ColdFusion Developer
[EMAIL PROTECTED]


______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to