Adobe COLDFUSION 9 Manual page 330

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Developing CFML Applications
<cfapplication name="ETurtle"
sessiontimeout=#createtimespan(0,1,30,0)#
sessionmanagement="yes">
<!--- Initialize the Session and Application
variables that will be used by E-Turtleneck. Use
the Session lock scope for the session variables. --->
<cflock scope="Session"
timeout="10" type ="Exclusive">
<cfif not IsDefined("session.size")>
<cfset session.size = "">
</cfif>
<cfif not IsDefined("session.color")>
<cfset session.color = "">
</cfif>
</cflock>
<!--- Use the Application scope lock for the Application.number variable.
This variable keeps track of the total number of turtlenecks sold.
The following code implements the scheme shown in the Locking Application
variables effectively section --->
<cfset app_is_initialized = "no">
<cflock scope="Application" type="readonly">
<cfset app_is_initialized = IsDefined("Application.initialized")>
</cflock>
<cfif not app_is_initialized >
<cflock scope="application" timeout="10" type="exclusive">
<cfif not IsDefined("Application.initialized") >
<cfset Application.number = 1>
<cfset Application.initialized = "yes">
</cfif>
</cflock>
</cfif>
<!--- Always display the number of turtlenecks sold --->
<cflock scope="Application"
timeout="10"
type ="ReadOnly">
<cfoutput>
E-Turtleneck is proud to say that we have sold
#Application.number# turtlenecks to date.
</cfoutput>
</cflock>
The remaining sample code could appear inside the application page where customers place orders:
Last updated 8/5/2010
325

Advertisement

Table of Contents
loading

Table of Contents