> Hi,
> I'm upgrading from CF 4.0.1 to CF 5 and I have read that
> locking changed
> from 4.0 to 4.5. I'm currently using application variables
> and wanted some
> thoughts on this:
> Does anyone see any issues with moving all of my
> application variables to
> the request scope in application.cfm using:
> <cflock SCOPE="Application" Timeout="30" Type="Readonly">
>      <cfset request=duplicate(application)>
> </cflock>

> So am I correct that this would mean if i had variables
> application.foo and
> application.foobar they will then be request.foo and
> request.foobar?  Would
> it be wise to set the request variables in another page
> other than
> application.cfm since application.cfm is always hit?
> OR is there a better way to deal with this? Any
> tips/tricks/advice is
> appreciated!

It depends how much data is in your application scope and how much of it
will be relevant on any given page... I'm inclined to think that you won't
want to shot-gun it quite that much, although you may not have to go too
much further... Instead of duplicating the entire application scope, try and
figure out what information will be specific to a given request in the
application.cfm, for instance, if this is an app which requires a login and
user session information is stored in the application scope, you might copy
just the user session structure for the current user and not the whole array
or structure containing all logged in users.

For the remaining variables, you might loop through the application
structure and copy only those which are simple values, i.e.

<cflock scope="application" timeout="30" type="readonly">
        <cfset request.user = application.user[urltoken]>
        <cfloop item = "x" collection="application">
                <cfif issimplevalue(application[x])>
                        <cfset request[x] = application[x]>
                </cfif>
        </cfloop>
</cflock>

I've had good luck with a similar application architecture on CF5.

Isaac
Certified Advanced ColdFusion 5 Developer

www.turnkey.to
954-776-0046

______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to