> -----Original Message-----
> From: Mauricio Giraldo [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, September 03, 2003 11:58 PM
> To: CF-Talk
> Subject: request vs application scope
> 
> Hi
> 
> We are developing this web-based HTML editor:
> http://www.elefectoaxe.com.co/spaw/test.cfm
> 
> It uses CFCs and has several configuration variables (default
language,
> folder to place images into, etc) that are created in a couple of
> configuration templates. Right now we handle these configuration
variables
> in the REQUEST scope. Would it be a better idea to handle them in the
> APPLICATION or some other scope? What is the criteria for scope
choosing?
> This is a SourceForge project and once we upload it you can take a
look at
> the code.

I talk about this quite a bit in my guide to CF variables here:

http://www.depressedpress.com/DepressedPress/Content/ColdFusion/Guides/V
ariables/Index.cfm

In general, when using CFCs I would recommend creating the variables
inside the CFCs as instance variables upon invocation rather than "look
out" of the CFC to external data.

That being said and from the little you've said it seems like the
Application makes the most sense.  Using the Application scope means
that these variables will be created once, and only once, and use up
only that much RAM for all users.

Using the Request scope would mean that each request would have to
create these variables and that the RAM usage would be greater (each
request having its own copy of the data).

Using the Request scope made a LOT of sense in CF 5 and below as using
the Application scope meant a lot of locking.  The Request scope was
more resource intensive, but allowed for simpler code less likely to
fall prey to deadlocks or resource contention.

With MX's low-level locking server stability from lack of locking has
disappeared.  Its now safe to store this kind of information in the
Application scope and access it directly.

In a sense the Request scope, which in 4.5 and 5.0 became a nice
replacement for the Application scope for many things, has now be
superseded by the improved Application scope.

Jim Davis


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Get the mailserver that powers this list at 
http://www.coolfusion.com

Reply via email to