I'm using the Application scope to cache "type information" about the
various database objects in my application in order to speed up
database access. Each type has a corresponding "type handler" cfc that
does all the getting/setting/deleting of a specific type of object in
the database.

At first, I was creating the "type handler" cfc object (using
createObject ()) every time I wanted to access a database object, but
I found that createObject is very slow. Now I create the "type
handler" object once and store it in the "type information" that is
cached in the Application scope. So the "type handler" cfc's are now
being cached after I create it.

In order to avoid having to lock my application scope for the entire
time it takes to access the database, I lock the application scope,
copy the "type handler" cfc to the caller's scope using the duplicate
() function, and then make method calls into the copied version of the
"type handler" cfc.

Is there a better way to do this?

I've got a several other instances where I'm unsure about the best
method for accessing data and cfc's that are cached in the Application
scope without having to lock everything all the time. Another example
is that I create a siteMap cfc object that contains a hierarchical
array-based structure that is accessed on just about every request. I
do things like... display links to pages within the current section of
the site. I've got a method called "getSiteMapArray ()" that returns
the site map array. I haven't been calling the Duplicate () function
on the array before returning it... does anyone know if that might be
a source of a memory leak?

-- 
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