Adobe ColdFusion 8

Creating and deleting session variables

Use a standard assignment statement to create a new session variable, as follows:

<cflock timeout=20 scope="Session" type="Exclusive">
    <cfset Session.ShoppingCartItems = 0>
</cflock>

Use the structdelete tag to delete a session variable; for example:

<cflock timeout=20 scope="Session" type="Exclusive">
    <cfset StructDelete(Session, "ShoppingCartItems")>
</cflock>

Note: If you set session variables on a CFML template that uses the cflocation tag, ColdFusion might not set the variables. For more information, see TechNote 22712 at http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_18171.