Hi,
I'd like some help clearing up a few issues surrounding the confusing nature
of CFLOCK.
Do I have to make all references to Session variables such as session.id
within a CFLOCK? Does this include references made using them as form and
URL variables (is this different depending upon wether the server is 4 or
4.5)??
In my Application.cfm page I have something like:
<CFLOCK name="#application.applicationName#" type="EXCLUSIVE" timeout="30">
<CFIF Not IsDefined('Application.datasource')>
<CFSCRIPT>
Application.dsn = "OnlineStore";
Application.mapped_path = "/mystore";
Application.site_name = "My Store";
</cfscript>
</CFIF>
</CFLOCK>
Is this appropriate use of CFLock? (particularly is it ok to use it around
CFScript?). As I am setting my DSN here for use with every query and
referencing it repeatedly should I put a readonly CFLock around my queries
even though Application.DSN never changes?
Would I be better off loading the Application.dsn into a local variable and
referencing that instead? e.g
<CFSET myDSN = Application.DSN>
Then would I still need CFLOCK around references to myDSN?
Would this work with all session and app variables removing the need for
repeated use of CFLock - e.g setting CFID to a locl var?
I'm working on an online store and would like to avoid having to re-query
for the category names on every page. So if I put this in application.cfm:
<cfif NOT IsDefined("SESSION.CatQuery")>
<cflock name="#SESSION.SessionID#" timeout="30">
<cfquery name="SESSION.CatQuery" datasource="#dsn#">
SQL..
</cfquery>
</cflock>
</cfif>
Or, it would seem even better to chang all the above session variables to
applcation variables so the first time they visit the page it doesn't even
need to run the query then. Then when the DB is updated I could set another
variable to indicate that and ensure the query is rerun. (if that makes
sense) Is that a reasonable thing to do?
Thanks for reading, I'm pretty confused about some of this as you can
probably see.
Ben.
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.