You can use the Cold Fusion Administrator to change the default storage mechanism for your client variables. This change will indicate which storage mechanism is used for each application on the server unless otherwise specified within the App 1; cat; on. cfm template. When you open the ColdFusion Administrator, select the Variables option under the Server section on the left-hand frame.
Adding a Client Storage Data Source
In the first section of the ColdFusion Administrator Variables page, called Client Variable Storage, you can add a configured data source. You would add a data source if you want to store your client variables in a database as opposed to the registry or cookies. Advantages of storing clier+ variables in a database include:
• The ability to easily view information related to all clients of an application
• The ability to query the data from this database
• The option to easily port the data from one server to another
Before you can add a data source in this section, you must have already configured your data source in the Data Source section of the Coldfusion Administrator.
After you configure your data source, it is available to you under the pull-down Name menu. Select the data source you wish to add for client storage, then select Add. Follow the instructions on the next screen to create the client storage data source.
When a client storage data source is added, two tables are created in the data source database. The first table, (DATA,stores information in the following field names:
Cfid Stores a combination of the (FID and (FTOKENvariables (text field that holds a maximum of 20 characters)
App Stores the application name (text field that holds a maximum of 64 characters)
Data Stores a combination of the HITCOUNT, LASTYISIT,and TIMECREATEDvariables (memo field)
The second table, CGLOBALst,ores additional information in the following field names:
Cfid Stores a combination of the CFID and CFTOKEN variables (text field that holds a maximum of 20 characters)
Data Stores a combination of the HITCOUNT, LASTVISIT,and TIMECREATEDvariables (memo field)
Lvisit Stores the date and time of a client’s last visit (Date/Time field)
You should notice that Reg; stry is already available with a type of System Registry. If you select Registry , you will see a screen where you can modify the default expiration time period for client variables stored in the registry. The default is 90 days.
Setting the Default Client Variable Storage
The second section of the Variables screen is for setting the default storage mechanism for client variables. The two options available are registry and cookie. Registry is the default when ColdFusion is first installed.
If Registry is chosen, then all client variables for any ColdFusion application on your server will be stored in the server registry unless otherwise stated ill the application’s CFAPPLlCATIONtag.
If Cookie is chosen, then all client variables for any Cold Fusion application on your seiver will be stored in a client-side cookie called CFGLOBALS (unless otherwise stated in the application’s CFAPPLICATIONtag). Be careful in choosing this option! Check the warnings about using cookies later ¥t the section “Client State Management and Cookies.”
If you want to specify a data source as your client storage mechanism, you must have first added the data source under Client Variable Storage (described in the previous section). Then you can select the data source in the pull-down menu.