ColdFusion Application.cfc - order of execution

Viewed 5170

I need a reality check - and hopefully an explanation (if my reality is wrong).

The way the CF application framework evaluates things is this (my understanding) - request is passed to cfserver

  • cf finds an application.cfm or cfc (based on traversing rules)

  • application.cfc executes (if found)

  • the THIS scope is set (a series of application specific vars can be set here but

some are required - such as "applicationTimeout" - then a series of events takes place -and methods fired if needed.

-- onApplicationStart()

----onSessionStart()

------onRequestStart()

etc.

so my questions

1) The THIS settings happens on EVERY page request - before anything else?

2) If I set an application variable, in onApplicationStart() - it is available in any process that happens after that - AND should persist in memory for the length of applicationTimeout() - correct?

3) so if I do something like this...

if ( isdefined("application.myvar" ) { this.something = application.myvar; }

it SHOULD work on any page request after the initial request that started the application scope.

however it doesn't appear to do so.

my reason for asking is this - there are some interesting application lever settings that need to be set in the THIS scope... a few of them could be 'intensive' (at least form the perspective of executing on EVERY request - so I want to do them only ONCE, set a structure in persistent mem, and then have those available as THIS.

am I making some wrong assumptions?

thx

5 Answers
Related