User Guide

Table Of Contents
298 Chapter 13: Designing and Optimizing a ColdFusion Application
Reviewing the code
The following table describes the code and its function:
Optimizing ColdFusion applications
You can optimize your ColdFusion application in many ways. Optimizing ColdFusion mostly
involves good development and coding practices. For example, good database design and usage is
a prime contributor to efficient ColdFusion applications.
In several places, this manual documents optimization techniques as part of the discussion of the
related ColdFusion topic. This section provides information about general ColdFusion
optimization tools and strategies, and particularly about using CFML caching tags for
optimization. This section also contains information on optimizing database use, an important
area for application optimization.
Code Description
<cfapplication name="Products"
clientmanagement="Yes"
clientstorage="myCompany"
sessionmanagement="Yes">
Names the application, enables Client and Session
scope variables, and sets the client variable store to the
myCompany data source.
<cfsetting showDebugOutput="No">
Ensures that debugging output is not displayed, if the
ColdFusion MX Administrator enables it.
<cferror type="request"
template="requesterr.cfm"
mailto="admin@company.com">
<cferror type="validation"
template="validationerr.cfm">
Specifies custom error handlers for request and
validation errors encountered in the application.
Specifies the mailing address for use in the request error
handler.
<cfset app_is_initialized = False>
.
.
.
Sets the Application scope variables, if they are not
already set. For a detailed description of the technique
used to set the Application scope variables, see
Chapter 15, “Using Persistent Data and Locking,” on
page 339.
<cflock timeout="20"
scope="Session"
type="exclusive">
<cfif not
IsDefined("session.pagesHit")>
<cfset session.pagesHit=1>
<cfelse>
<cfset session.pagesHit=
session.pagesHit+1>
</cfif>
</cflock>
Sets the Session scope pagesHit variable, which counts
the number of pages touched in this session. If the
variable does not exist, creates it; otherwise, increments
it.
<cfset mainpage = "default.cfm">
<cfset current_page =
"#cgi.path_info#?#cgi.query_string#
">
Sets two Variables scope variables that are used
throughout the application. Creates the current_page
variable dynamically; its value varies from request to
request.
<cfinclude template=
"commonfiles/productudfs.cfm">
Includes a library of user-defined functions that are used
in most pages in the application.