Hi
There,
So, I have a page
class that I lazy load to minimize initial application load time for large
sites. However, for performance purposes, I store each page object once it has
been created using the application scope (I don't have so many instances of the
page class that this would be a problem in terms of memory and each one is
fairly small).
So, my calling code
looked like this:
<cfscript>
// If
the page doesn't exist in application scope, initialize it (lazy
load)
if(not isDefined("Application.page.#ThisPageFilePath#"))
{"Application.page.#ThisPageFilePath#" = CreateObject("component","prototype.entity.systemsforge.Page").Init("#ThisPageFilePath#");};
if(not isDefined("Application.page.#ThisPageFilePath#"))
{"Application.page.#ThisPageFilePath#" = CreateObject("component","prototype.entity.systemsforge.Page").Init("#ThisPageFilePath#");};
</cfscript>
That looked plain
wrong (seemed to be wrong for anything other than a page something - e.g. a page
service to be worrying about whether or not a given page had been constructed or
not), so I created an Application.PageService, provided it with a
GetbyFilePath() method and put the above code in there.
Is this going in the
right direction?
Best
Wishes,
Peter
Peter
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).
An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
