Connie

Personally I've tended to store my global settings in an
application-scoped struct, but duplicate them into request scope for
unlocked usage, like this:

<cfset bSetup = false>
<cflock scope="APPLICATION" timeout="10" type="ReadOnly">
<cfif not isDefined( "application.settings")>
<cfset bSetup = true>
</cfif>
</cflock>
<cfif bSetup EQ true>
<cfscript>
strSettings = structNew();
strSettings.dsn = "(whatever)";
// etc
       </cfscript>
<cflock scope="APPLICATION" timeout="10" type="Exclusive">
Application.settings = Duplicate( strSettings );
</cflock>
</cfif>

<!--- duplicate settings into request scope --->
<cflock scope="APPLICATION" timeout="10" type="ReadOnly">
<cfset request.settings = Duplicate( application.settings ) />
</cflock>

You can then read the settings from request scope without having to
worry about locking.

Hope that helps

Alistair

Alistair Davidson
Senior Technical Developer
Headshift.com
Smarter, Simpler, Social
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to