Поделиться через


Source Schema for the Caching Application Block

This topic lists the XML elements and attributes used to configure the Caching Application Block. You can manually edit the XML data, but the Enterprise Library configuration tools greatly simplify this task. If you choose to manually edit the XML, use the schema information contained in this topic.

The configuration file has the following section handler declaration.

<configSections>
<section name="cachingConfiguration" 
         type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings,
               Microsoft.Practices.EnterpriseLibrary.Caching" />
</configSections>

The section handler declaration contains the name of the configuration settings section and the name of the section handler class that processes configuration data in that section. The name of the configuration settings section is cachingConfiguration. The name of the section handler class is Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings.

cachingConfiguration Element

The cachingConfiguration element specifies the configuration of a Caching Application Block. This element is required.

Attributes and Child Elements

The following sections describe attributes and child elements of the cachingConfiguration element.

Attributes

The following table lists the attributes for the cachingConfiguration element.

Attribute

Description

defaultCacheManager

The Caching Application Block uses this cache manager if the application code does not provide a named instance of a cache manager. This attribute is required.

encryptionProviders Element

The encryptionProviders element is a child element of the cachingConfiguration element. The encryptionProviders element lists the encryption providers that the backing stores can use. This element is optional.

add Child Element

The add element is a child element of the encryptionProviders element. The add element adds the name of an encryption provider. This element is optional. There can be multiple add elements.

Attributes

The following table lists the attributes for the add element.

Attribute

Description

name

The name of the encryption provider. The name must be unique within the section. This attribute is required.

type

The type name of a class that implements the IStorageEncryptionProvider interface. This attribute is required.

backingStores Element

The backingStores element is a child element of the cachingConfiguration element. The backingStores element lists the backing stores that the cache manager can use. If you do not specify a backing store during configuration, the block uses only the in-memory backing store. This element is required.

add Child Element

The add element is a child element of the backingStores element. The add element adds the name of a backing store. This element is required. There can be multiple add elements.

Attributes

The following table lists the attributes for the add element.

Attribute

Description

name

The name of the backing store. This attribute is required.

type

The type name of a class that derives from the BaseBackingStore class. This attribute is required.

encryptionProviderName

The name of an encryption provider. The name must be unique within the section. This attribute is optional.

partitionName

If you are using the database cache store, this attribute identifies the section or portion of the database that the cache manager will use. If you are using isolated storage, it identifies the section or portion of the isolated storage that the cache manager will use. This attribute is required.

databaseInstanceName

The name of the database instance. This attribute is required for the database backing store.

cacheManagers Element

The cacheManagers element is a child element of the cachingConfiguration element. The cacheManagers element lists the cache managers. Cache managers represent instances of caches that can be used in the application. This element is required.

add Child Element

The add element is a child element of the cacheManagers element. The add element adds the name of a cache manager. This element is optional. There can be multiple add elements.

Attributes

The following table lists the attributes for the add element.

Attribute

Description

name

The name of the cache manager. The name must be unique within the section. This attribute is required.

expirationPollFrequencyInSeconds

Sets the timer that regulates how often the background scheduler checks for expired items. This attribute must be a positive integer. This attribute is required.

maximumElementsInCacheBeforeScavenging

Sets the maximum number of items that can be in the cache before scavenging begins. This attribute must be a positive integer. This attribute is required.

numberToRemoveWhenScavenging

Sets the number of items to remove when scavenging begins. This attribute must be a positive integer. This attribute is required.

backingStoreName

The name of the backing store to use with this cache manager. This attribute is required.