Again - this falls under the category of personal preference... but in
general, I'd use the request scope (if you don't want the application
scope). This means your code in your custom tags will mimic code in
normal templates. For example:

<cfquery name="foo" datasource="#request.dsn#">

This 'breaks' the concept of custom tags as a 'black box'. But, if I'm
building a custom tag specifically for an application, I don't mind.
Plus, I can't think of a web site I've built in the last few _years_
that did not have a variable called dsn, whether it be application or
request.

Just my 2 cents.

Another reason to use the request scope - in CF5, the request scope was
a structure that you could inspect. You would not be able to do the same
w/ the Variables scope. (Of course, this is fixed in CFMX.)

=======================================================================
Raymond Camden, ColdFusion Jedi Master for Macromedia

Email    : [EMAIL PROTECTED]
Yahoo IM : morpheus

"My ally is the Force, and a powerful ally it is." - Yoda 

> -----Original Message-----
> From: Paul Giesenhagen [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, July 08, 2002 3:21 PM
> To: CF-Talk
> Subject: Re: Application vs Request........
> 
> 
> Good topic!
> 
> I have an application that I set a number of variables (for 
> every page).
> 
> Such as datasources, tablenames,  table widths, colors ect.. There are
> probably 30-40 in all.
> 
> Right now I set those as
> <cfset prefs.tablename = "customer_table">
> <cfset prefs.dsn = "customers"
> <cfset prefs.tableBGColor = "FFFFFF">
> ect...
> 
> Would it be better to set them in the request scope?
> 
> I know that varables.dsn would be faster than my prefs.dsn, 
> but  I wanted to
> keep prefs. seperate from variables.
> 
> I do use alot of Custom Tags, but I just use caller.prefs.dsn 
> to get the
> desired results.
> 
> I guess I am asking should I look at what I am doing and maybe go a
> different route?
> 
> Thanks
> Paul Giesenhagen
> ----- Original Message -----
> From: "Dave Carabetta" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Monday, July 08, 2002 2:13 PM
> Subject: Re: Application vs Request........
> 
> 
> > >oi CF-Talk,!!
> > >
> > >   ok  don't  flog  me..  but  since  most  app variables 
> are locked and
> > >set to a
> > >   request  scope......is  there any loss of "performance" 
> or is just
> > >putting all
> > >   app  scoped  variables  as  request  scoped  variables  in the
> > >application.cfm
> > >   acceptable...?
> > >
> >
> > The performance "degradation" is virtually negligible. For non-CFMX
> > applications I write, I use local-scoped variables 
> (variables or request,
> > depending on if I need them for custom tags) in an included 
> file in my
> > Application.cfm file.
> >
> > In one scenario, I tested setting 30 variables with a 
> stress testing tool
> > (15 simultaneous threads over a 10 minute span) and the 
> *worst* it ever
> got
> > was 28 milliseconds. Those results and others I've done 
> make this approach
> > much easier because I don't have to worry about locking 
> (except in race
> > conditions, of course).
> >
> > But that's just my approach. Others swear by locking. To 
> each their own,
> as
> > long as you lock where appropriate.
> >
> > Regards,
> > Dave.
> >
> >
> > 
> 
______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
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