Hi Jason,

I'll try to answer our questions.

Jason Southern wrote:
> It is my understanding that when ColdFusion receives a request for a
> template, it first attempts to locate an Application.cfm file by scanning
> the directory from the template's present location all the way to the
> document root.  ColdFusion server reads and processes the first
> Application.cfm file it finds before processing the requested template.
> 
> Is this understanding correct?

Yes, with one caveat.  CF doesn't know where the document root might
be, so goes all the way up to the root ('/').  I don't like this,
it is expensive, but you can map directories that are not in your
webserver document tree via the CF administrator or even your web
server.
It is a good idea for performance and security to always have an
(empty except for a comment) Application.cfm at the top level of your
CFML doc tree.

> 1.  Do variables scoped with the Application field type point to the same
> memory space for a given application as defined by <CFAPPLICATION> in
> Application.cfm?  If not, how are variables scoped with the Application
> field type different from variables that exist in other field types such as
> CGI, Variables, Form, URL, etc.?

The Application scope is shared by all template which have the same
'Name' attribute for the CFAPPLICATION tag, yes.


> 2.  Does ColdFusion execute variable assignment statements in
> Application.cfm on each request (e.g. <CFSET Application.var1 = "Test">)?

Yes, it does.


> 3.  What does the IsDefined() function evaluate to determine if a variable
> has been defined?  Does the following expression
> IsDefined("Application.var1") initiate a read on shared memory space?  In
> other words, does a lock need to be placed around this expression as in the
> following example:

[example deleted]

Yes and yes.
IsDefined looks up the variable in the Symbol table for the scope.
It is reading shared memory and locks are required.


> 4.  What is the difference between using Application.cfm to store
> application-level data and simply using <CFINCLUDE> to include another
> template that contains variable initialization statements like the
> statements below?
> <CSCRIPT>
>    var1 = 12;
>    var2 = 13;
> </CFSCRIPT>

Very little, other than their scope is shared and persistent,
so you can put things that are expensive (say a DB lookup of state
names)
but you want to have available across all pages in your application.

I hope this helps.
-- 
Tom Jordahl                     [EMAIL PROTECTED]
Allaire Development             http://www.allaire.com
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-linux%40houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_linux or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to