Hi Guyz,

I've implemented a session based shopping cart with the following components.

1) CartItem - ProductId, Name, Color, Cost etc with Getter and Setter methods

2) Cart - An array of CartItem with AddCartItem, GetCartItems, RemoveCartItem, etc methods

3) CartManager - Session facade that controls access to the Cart stored in Session


CartManager has the following method to allow me to retrieve an Array of CartItems from the session.

<cffunction name="GetCartItems" access="public" returntype="array" output="false">
  <cflock scope="Session" timeout="10" type="readonly">
      <cfreturn Session.Cart.GetCartItems() />
   </cflock>
</cffunction>

So my question is this. If I code Items = CartManager.GetCartItems() is it safe to use the Array of CartItems now that I am no longer inside the lock?

For example, can I safely call Items[1].GetColor() or Items[1].SetColor(color)?

Cheers, Pete (aka lad4bear)




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

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]


Reply via email to