Spectra uses the request scope extensively. It's a good place to put
thread-safe global variables. What you've heard about eliminating the need
for session, and application locks is true. You can copy all your session
and application variables to the request scope and not need to use CFLOCK
around each call to these variables.

You would do something like this:

<cfset request.ses = duplicate(session)>
<cfset request.app = duplicate(application)>

This code would go in your application.cfm file so those variables get
copied every time someone requests a page.

You CANNOT use:

<cfset request.ses = session>
<cfset request.app = application>

In most languages, including ColdFusion, when you set a variable equal to a
complex data set (like a structure, query, array, etc.), it will create a
reference back to the complex data set. In other words, it's just creating a
pointer to the original data in the session or application scope, so you're
still not thread safe.

Using the duplicate() function will make a complete copy of those structures
(the session and application scopes are ColdFusion structures) into the
request scope and you will be accessing the copied data, not the original
data in in the shared scope.

HTH,

Jason

----
Jason Aden
Allaire Certified Developer
[EMAIL PROTECTED]
www.wwstudios.com

> -----Original Message-----
> From: Carol Bluestein [mailto:[EMAIL PROTECTED]]
> Sent: Friday, February 02, 2001 10:25 AM
> To: CF-Talk
> Subject: Re:RE: Request Scope
>
>
> Is any one out there using the request variables extensively?
>
> I'd like to know more about the request scope and how to use it.
> I've found
> very little in my documentation (4.0.1) and have searched the
> allaire knowledge
> base with no obvious results (a lot comes up but the titles lead
> me to believe
> they were not pertinent).  I've heard that using request scope
> variables can
> help limit the "need" for session and/or application variables so that the
> necessity of locking is minimized and in some cases eliminated.
> I also admit
> that I could have heard this out of context.
>
> Any clarification and information would be appreciated.
>
> Thanks, in advance,
> Carol
>
>
> Carol L. Bluestein
> Senior Programmer
> NYS Office of Real Property
> 518-486-6335
> [EMAIL PROTECTED]
>
>
> ____________________Reply Separator____________________
> Subject:    RE: Request Scope
> Author: [EMAIL PROTECTED]
> Date:       2/1/01 8:06 PM
>
> > The "Request" scope was available in CF 4.0 wasn't it?
>
> Yup, just tested on our 4.0.1 server and it worked perfectly
>
> Philip Arnold
> Director
> Certified ColdFusion Developer
> ASP Multimedia Limited
> T: +44 (0)20 8680 1133
>
> "Websites for the real world"
>
> **********************************************************************
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager.
> **********************************************************************
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to