While I agree in principle with your sentiments here, the request scope can 
help out in some cases with performance.


>
>   Actually, I prefer not to use the request variable scope.
>   Parameter passing is important part of custom tag re-usability.  Writing
>custom tags that are based on 'global' variables (I.E. the request scope is
>global to the current request) violates the re-usability constraint.
>   The only reason I see for the request scope over the variables scope is
>to avoid parameter passing.
>
>
>At 10:39 AM 6/26/2002 -0400, you wrote:
> >Jeffry,
> >
> >You may want to try using the REQUEST variable scope, as it is available
> >to all referenced pages (using includes, custom tags, etc.).
> >
> >However, as far as "the best" variable scope.....  each has strengths
> >and weaknesses.
> >
> >Please let me know if I can be of assistance.
> >Thank you,
> >
> >John M Stover II
> >[EMAIL PROTECTED]
> >
> >
> >-----Original Message-----
> >From: Jeffry Houser [mailto:[EMAIL PROTECTED]]
> >Sent: Wednesday, June 26, 2002 10:26 AM
> >To: CF-Talk
> >Subject: RE: What is the best variable scope?
> >
> >   Application scope variables are a shared scope.
> >   You should always lock shared scopes (I.E. Session, Application, and
> >Server) variables.  In version of ColdFusion 5 or less, this will
> >prevent
> >memory corruption and server crashes.  In ColdFusion MX, Macromedia
> >fixed
> >the problems with memory corruption / server crashes, but you still want
> >to
> >lock to avoid racing (I believe the term is racing) conditions, which is
> >
> >two people accessing the same variable at the same time.
> >
> >   There is more information about racing conditions in ColdFusion
> >documentation, and if memory serves me there is a locking article on the
> >
> >desdev site somewhere.
> >
> >
> >At 10:15 AM 6/26/2002 -0400, you wrote:
> > >I wasn't aware you should lock application scope variables. What's the
> > >reason behind it?
> > >
> > >On Wed, 26 Jun 2002, Jeffry Houser wrote:
> > >
> > > > At 03:18 AM 6/26/2002 -0400, you wrote:
> > > > > >   However, many people use the application scope for things that
> >I
> > > don't
> > > > > > consider good ideas (such as a datasource varaible).
> > > > >
> > > > >Can you elaborate?
> > > >
> > > >   In the example I specified, a datasource variable.
> > > >
> > > >   First you have to put it into an application variable, so code
> >similar to
> > > > this goes into the Application.cfm :
> > > >
> > > > <cflock>
> > > >   <cfif isDefined("Application.dsn")>
> > > >    <cfset application.dsn = "mydatasource">
> > > >   </cfif>
> > > > </cflock>
> > > >
> > > >
> > > >   Now you have to lock all your query statements every time you
> >reference
> > > > the variable:
> > > >
> > > > <cflock>
> > > >   <cfquery datasource="#application.dsn#">
> > > >
> > > >    </cfquery>
> > > > </cflock>
> > > >
> > > >
> > > >    In this case, you have added additional locking code, which takes
> > > > additional processing time, with no real added benefit for storing
> >the
> > > > datasource information in an application variable.
> > > >
> > > >
> > > > --
> > > > Jeffry Houser | mailto:[EMAIL PROTECTED]
> > > > Need a Web Developer?  Contact me!
> > > > AIM: Reboog711  | Fax / Phone: 1-203-379-0773
> > > > --
> > > > My CFMX Book:
> > > > <http://www.amazon.com/exec/obidos/ASIN/0072225564/instantcoldfu-20>
> > > > My Books: http://www.instantcoldfusion.com
> > > > My Band: http://www.farcryfly.com
> > > >
> > > >
> > >
> >
> >
>
______________________________________________________________________
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/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to