Question
Locking when using a component as an object in the application scope...
I have a component that I am building right now that hold
application settings that are stored in a database table. The
settings are maintained in a structure "variables.settings" within
the component and can only be accessed by get and set methods. I
use the following to create the instance of the object:
<cfset application.settings = createObject("settings","component").init() />
Now when getting a setting I do not think locking is needed as its just reading the value and I am not really concerned with a race condition...
But when using the set method which will update the value of the setting.... should I be locking that as technically the object is in a shared variable scope? Or is it safe because its within the cfc/object?
If locking is needed, would I need to lock when using the set method? or can I just build the lock into the set method so that its always there?
<cfset application.settings = createObject("settings","component").init() />
Now when getting a setting I do not think locking is needed as its just reading the value and I am not really concerned with a race condition...
But when using the set method which will update the value of the setting.... should I be locking that as technically the object is in a shared variable scope? Or is it safe because its within the cfc/object?
If locking is needed, would I need to lock when using the set method? or can I just build the lock into the set method so that its always there?
