> Please correct me on any of the following:
> 
> The REQUEST scope:
> 
> 1. Doesn't need to be locked.

True.

> 2. Is stored in server memory.

This is true, but not in the way you most likely mean.

Most variables are stored in memory at some point. Request variables are not
stored persistently in memory, though, as are Session, Application and
Server variables. They're only available for the duration of the response to
a single page request (thus the name of the scope).

> 3. Is only generated once per application (as opposed to once 
> per client session).

If you use them in Application.cfm, which is how you'd typically use them
for constants, they'd be generated for each page request within that
application.

> 4. Is available to all templates (custom tags, includes, base, etc.)

True. This is the only thing that differentiates the Request scope from the
local Variables scope.

> 5. Should be primarily used for "constants".

I would argue that constants should be placed within the Request scope, but
it can come in handy for other things as well.

> Is there a negative to using it?

Of course there is. Nothing is free in programming, or anywhere else. Each
alternative has advantages and disadvantages. The advantage of using the
Request scope for constants is that you don't have to worry about locking.
The disadvantage is that those variables will be created and destroyed for
each page request.

It's up to you to evaluate whether the advantages outweigh the disadvantages
for any particular use. For most variables that are used similarly to
constants, the Request scope makes sense, in my opinion. If you wanted to
make a recordset available on each page, though, the Request scope wouldn't
be a very good idea at all.

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/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to