> In your application
> <cfset application.variablename = "variable">
> 
> In your custom tag
> #application.variablename#
> 
> Scoping it as request.variablename is BAD! The request scope 
> is set for each PAGE request and is not the same thing as 
> application scope. Before I figured out my application scoping 
> problem I set everything to request scope only to have to go 
> back and change it later. This is a big performance issue if 
> you run a big site.

I wouldn't go so far as to say that using the Request scope is bad. However,
it's not a replacement for the Application scope. Each is appropriate for
different things.

The Request scope is good for constants - variables which won't change their
values over the lifespan of the application, and which are created with
simple CFSETs. The cost of recreating them for each page is minimal. You
wouldn't want to use the Request scope to store data objects like recordsets
and arrays, though, unless you wanted to discard them at the end of
processing for all scripts building a response to a single request.

The Application scope is good for persistent values which may change over
the lifespan of the application.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        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