You enable client state management in the ColdFusion Server using the Administrator to specify a data source repository where you want to store client variables.
Although you can select and use an existing data source to store client variables, Allaire recommends creating a new data source specifically for the purpose of storing client variables. By separating data sources, you can more easily define security options for the data sources used in your ColdFusion environment.
When creating a new data source for client variables, you do not need to create any tables in the data source. ColdFusion automatically creates the tables necessary to store client variables.
|To create a client variable data source:|
Excel and Text data sources do not appear as valid data sources for use in configuring an external client data source repository. Neither data source type supports the SQL required for the client variable repository.
|To enable your client variable data source:|
When you configure a data source for client variable storage, you have several options for configuring the data source:
Ordinarily, you don't want to have client variables preserved indefinitely. ColdFusion allows you to set a limit to the length of time a client variable remains active. You can configure your client variable data source to expire client variables after some number of days you specify.
As an example of how this can be useful, take the case of an online store. A user adds items to his or her shopping basket, the details of which are stored as client variables in a ColdFusion data source, but never completes the transaction, instead, choosing to end the session. You want to be able to easily clear the contents of the shopping cart after some number of days. Enabling ColdFusion to purge clients can help keep your client variables data source from getting cluttered with data you don't need.
By default ColdFusion updates client variables for every page request. Use this option if you don't want ColdFusion to perform these updates. When updates are disabled, ColdFusion only updates global client variables when they are first created and when they are updated. Since updating global client variables for every page request requires a trip to the data source and back, disabling updates helps to improve the performance of your application pages.
Use this option to allow ColdFusion to create the tables necessary for client variables when you first configure the data source for this purpose. As you configure other servers in your cluster to use this client variables data source, be sure to disable the option for ColdFusion to create the necessary tables. If you inadvertently enable automatic table generation, ColdFusion generates a SQL error because it tries to create tables that already exist.