Hi,

Is there a way to encapsulate all locking and interaction with CFCs stored
in persistent scopes (application, session)?

For example, I would like to be able to do the following without locking:
        MyPersistentVars. UpdateCustomer(Data1, Data2, Data3)

Basically I am updating my Customer CFC, which is stored in within
MyPersistentVars CFC, which is stored in session scope. The MyPersistentVars
encapsulates the locking required for updating Customer.
 
One bad way to do this, would be to:

- save MyPersistentVars CFC in session
- load Customer object and save it in variables.instance of MyPersistentVars
- Create methods within MyPersistentVars with the same names as ALL the
methods in Customer CFC

So if Customer has a method called UpdateCustomer(), you would also have a
method in MyPersistentVars called UpdateCustomer() that would look like
this:

<cffunction name="UpdateCustomer">
    <cflock scope="session">
          <cfset variables.CustomerObj.Update()
    </cflock>
</cfunction>

This is of course, is extremely redundant and hard to maintain, so what else
can we do?

Cheers,
Baz





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


Reply via email to