You can put a CFC instance in the Session or Application scope. This way, the component properties continue to exist while the scope persists. For example, you might want to use a CFC for a shopping cart application, where the shopping cart contents must persist for the length of the user's session. If you put the shopping cart CFC in the Session scope, you can use component properties to store the cart contents. For example, the following line creates an instance of the shoppingCart component in the Session scope:
<cfobject name="Session.myShoppingCart" component="shoppingCart">
Code that manipulates persistent scope CFC properties must be locked, just as all other code that manipulates persistent scope properties must be locked. Therefore, you must lock both of the following types of application code:
If you put multiple CFC instances in a single persistent scope, you can create a named lock for each CFC instance. For more information on locking, see Using Persistent Data and Locking.