Skip to main content
Inspiring
June 29, 2006
Answered

application scope components

I've been building an image gallery application using components.

In my application file I have
<cfset application.gallery = createObject("component","app.gallery").init(application.dsn)>

Now every time I want to generate a gallery I do this
<cfset Variables.Gallery = application.gallery.getGallery(URL.fromRec,URL.count,URL.continent,URL.country,URL.city,"#URL.pic#")>

It just occured to me that this may be a problem. I this ok, or will I be affecting every users gallery on the site, by doing this under the application scope?


This topic is closed to new replies. Start a new post to keep the conversation going.
BKBK
BKBKCorrect answer
Community Expert
June 29, 2006
I think it's OK. You apparently define just one instance of application.gallery. If you don't update it throughout the life of the application, there will be no race conditions. Also, 'variables' is not a shared scope, and so variables.gallery will always be local.




1 reply

BKBK
Community Expert
BKBKCommunity ExpertCorrect answer
Community Expert
June 29, 2006
I think it's OK. You apparently define just one instance of application.gallery. If you don't update it throughout the life of the application, there will be no race conditions. Also, 'variables' is not a shared scope, and so variables.gallery will always be local.




Translate