I apprecaite all the comments.

I was considering storing lookup values in either scope for easy referencing
throughout the application.
Not everyone would be used but many are used multiple times.

Ex: Being able to call the function:  application.lookup.company('some
company name');
would return the query scope qCompany and contain things like name, address,
etc...

Or something similar. This is where data may change frequently but not the
database structure.

I can see advanatages of both session and application scopes. My initial
thought was be reducing any overhead by creating the objects either
onApplicationStart or onSessionStart that way they would already exist for
the user's request.

(Mark.. I will read up on your blog after my meeting.. Thanks!)




On Wed, Sep 24, 2008 at 9:26 AM, Gaulin, Mark <[EMAIL PROTECTED]>wrote:

> Where to store the object would depend on the nature of the object...
> Does it have internal state (variables) that are specific to a given
> user (so, maybe use session, but definitely not application), or is the
> object sharable by every user (so, application might work).
>
> I tend not to cache "lite" CFC objects in either session or application
> scope, just to keep things simple, especially during development when
> you are changing the CFC and the cached versions are "old"... This can
> get really annoying.
>
> One habit I found myself in is assigning CFCs to the request scope in
> application.cfm... This gives every page access to them via request and
> those pages don't need to know where the "real" object lives... It could
> be session, or application, or created on-the-fly in application.cfm.
> This is probably not be a good idea to do in all cases... it may some
> your code read funny; using session.shopingCart probably feels better
> than request.shopingCart.  But for global sorts of things like you are
> probably talking about, pulling the object from session or application
> and assigning it to request might not be a bad idea.
>
> Thanks
>        Mark
>
> -----Original Message-----
> From: Randy [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, September 24, 2008 9:07 AM
> To: CF-Talk
> Subject: CFC Objects (Best Practice)?
>
>  To those who use CFCs as Objects:
>
> Is it best to create the CFC objects within the application or session
> scope to be called throughout the application?
>
> Ex:
>
> -- OnApplicationStart
> <cfscript>
> application.lookupCFC = createobject('component','cfcs.lookup');
>  </cfscript>
>
> -- OnSessionStart
>  <cfscript>
> session.lookupCFC = createobject('component','cfcs.lookup');
>  </cfscript>
>
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:313018
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to