On Fri, 11 Feb 2005 09:46:46 +0100, Micha Schopman
<[EMAIL PROTECTED]> wrote:
> One thing people need to keep in mind, is that effectively there will be
> no real degrade of performance. You only move logic for checking session
> state (and people have been logged in or not) from the template normally
> called after application.cfm, to application.cfc.

Just to clarify what I think Micha means...

If you have code in Application.cfm that says:

<cfapplication name="someapp" .../>
<cfif not structKeyExists(application,'init')>
<cflock scope="application" type="exclusive" timeout="10">
.... do a bunch of application init ...
</cflock>
</cfif>
<cfif not structKeyExists(session,'user')>
<cflock scope="application" type="exclusive" timeout="10">
.... do a bunch of session init ...
</cflock>
</cfif>
.... a bunch of variables / request setup ...

When you change this to Application.cfc you'll end up with:

<cfcomponent>
<cfset this.name = "someapp">
....
<cffunction name="onApplicationStart">
.... do a bunch of application init ...
</cffunction>
<cffunction name="onSessionStart">
.... do a bunch of session init ...
</cffunction>
<cffunction name="onRequest">
<cfargument name="targetPage">
.... a bunch of variables / request setup ...
<cfinclude template="#targetPage#">
</cffunction>
</cfcomponent>

Note several things:
1. you no longer need to lock
2. you no longer need to test for app / session init on every request
- CF does it automatically
3. only onRequest is called on every request - onApplicationStart is
called just once per application and onSessionStart is called just
once per session.

So overall you gain performance from not having tests for app /
session but you lose performance for a function call and an include. I
think it's a small price to pay for the benefits of cleaner
initialization.
-- 
Sean A Corfield -- http://www.corfield.org/
Team Fusebox -- http://www.fusebox.org/
Breeze Me! -- http://www.corfield.org/breezeme
Got Gmail? -- I have 49, yes 49, invites to give away!

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:194353
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to