XML-Based Client Configuration (Windows Server AppFabric Caching)

You can use an XML file to configure the client caching features of Windows Server AppFabric. An XML-based configuration for the cache client is an excellent choice when configuration details can change after compiling the application. By having an application configuration file, changes such as setting cache host connection details or trace levels are quick and easy.

Using an XML application configuration file is not the only choice you have for configuring the cache client. You can also configure the cache client programmatically by providing configuration settings to the DataCacheFactory class constructor. For more information, see Programmatic Client Configuration (Windows Server AppFabric Caching).

If any settings are specified in the application configuration file when configuring the cache client programmatically, the programmatic settings always take precedence.

Configuration Elements

The following XML elements are used to configure the cache client in the application configuration file.

  • <configSections>: For AppFabric caching features to work, this element must be the first element in the application configuration file. It contains child elements that tell the runtime how to use the dataCacheClient element.

  • <dataCacheClient>: This element is the primary element used to configure the cache client. It is the parent to the elements used to enable local cache (localCache) and specify the cache hosts (hosts).

  • <localCache>: This optional element specifies the local cache settings, and is a child of the dataCacheClient element. Local cache is disabled if the <localCache> element is not present or if the isEnabled attribute is set to "false". The sync attribute allows you to specify how locally cached objects will be invalidated: TimeoutBased or NotificationBased. The ttlValue attribute specifies the default length of time that objects stay in the cache before they expire. For more information about invalidation, see Expiration and Eviction (Windows Server AppFabric Caching).

  • <clientNotification>: This optional element allows you to specify a custom poll interval value. The pollInterval is used to specify how many seconds it should wait before checking for new cache notifications. For more information about cache notifications, see Cache Notifications (Windows Server AppFabric Caching).

  • <hosts>: This element is a parent to the host elements that specify the cache hosts. It is a child of the dataCacheClient element.

  • <host>: This element specifies one cache host. Ideally, use host to specify a lead host. This element is a child of the hosts element.

  • <securityProperties>: This optional element specifies the security mode and protection level that should be used to communicate with the cache cluster.

  • <transportProperties>: This optional element specifies the transport properties for the communication with the cache cluster.

For more information about the application configuration file settings, see Application Configuration Settings (Windows Server AppFabric Caching).

In This Section

See Also

Community Additions