I've got a struct containing other structs that contain components.
This is how I cache data type information for my application. Each
data type uses a CFC for data access, and don't want to keep having to
create a component each time I need to access data. So type
information and corresponding CFCs are cached.

Here's sample code that represents how one data type is cached:

<cfset dataTypes = StructNew ()>

<cfset dataTypes.article = StructNew ()>
<cfset dataTypes.article.name = "Article">
<cfset dataTypes.article.handler = createObject ("component",
"types.article").init ()>

Here's my question: What's the best way to access the handler?

I'm currently doing this (the variable "type" specifies the type of
data being accessed):

<cfif StructKeyExists (type)>
   <typeInfo = StructFind (dataTypes, type)>
</cfif>

and then to get data:

<cfset data = typeInfo.handler.getData (id)>

I'm guessing that StructFind will return a copy of the struct, which
will cause the handler component to become duplicated in memory. If
that's true, how should I do this without duplicating the component in
memory?

-- 
You received this message because you are subscribed to the Google Groups 
"CFCDev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cfcdev?hl=en.

Reply via email to