Well - not really - it won't single thread the application - at least as
long as you END the lock (and end it as quickly as possible).  ;^)


However it will lock (get it!) the session scope WHILE you're writing to
(or reading from) it.  As a general rules of thumb the only things
inside a CFLock should be CFSETs - don't place your query in there,
don't place the <CFIF> in there, etc.


Performance won't be affected (at least in any noticeable sense) and
you'll.


Jim Davis


-----Original Message-----
From: Tony Weeg [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 07, 2003 10:25 AM
To: CF-Talk
Subject: RE: application.cfm


I think you should beware using <cflock> in your application.cfm file,
especially if you set it
to EXCLUSIVE, this will essentially make your application a ONE THREADED
application.  since
application.cfm is a "RUN ON EVERY PAGE REQUEST" file, this may cause
unwanted results.

just a caveat.

...tony

tony weeg
senior web applications architect
navtrak, inc.
www.navtrak.net
[EMAIL PROTECTED]
410.548.2337

-----Original Message-----
From: Bushy [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 07, 2003 10:22 AM
To: CF-Talk
Subject: RE: application.cfm

Are you saying I should put a <cflock around all my SESSION.variable
that
I'm defining with <cfset?

If so, whats the default <cflock?

Something like this (in the Application.cfm).  This assumes that you're
using the session scope on CFMX - if you're using CF 5 or below you
should
lock the accesses to the session scope to prevent server
instability:

<cfif NOT IsDefined("Session.Init")>
<cfquery name="myQuery"...>
Your query
</cfquery>
<!--- Do whatever you have to do with your variables You might only set
the
results of the query into the session scope like this: ---> <cfset
Session.myQuery = myQuery>
<!--- Now set your marker variable - once this is done this section of
code
won't run on the next request for this user ---> <cfset Session.init =
true>
</cfif>

There are actually many other ways to do this.  One that you might look
into
if you're only caching the query (and using it as it's returned) is to
cache
the query using the CachedWithin and CachedAfter attributes of CFQuery.
Once you set these if the SAME EXACT query is run again before the
refresh
period CF will pull the information from the cache and not bother
hitting
the database.

This makes for VERY fast access of the cached query and a very simple
page
(no marker variables or persistent scopes needed).  There are
limitations -
you read the docs on this, but it may be the way to go.

Jim Davis

-----Original Message-----
From: Bushy [mailto:[EMAIL PROTECTED]
Sent: Monday, October 06, 2003 11:49 AM
To: CF-Talk
Subject: re: application.cfm

HI,

I need to load my database fields into session and cookie variables for
my
application. The catch is I only need <cfquery the database once upon
initial log in via Windows NT authentication. I don't want the datbase
queried if a "refresh" is performed. Where or how can I do this. Sould
the
<cfquery be in my application.cfm off the main root of the website?

/inetpub/wwwroot/website/application.cfm

________________________________

  _____  


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to