Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Entering Configuration Information

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The latest Enterprise Library information can be found at the Enterprise Library site.

These procedures explain how to configure the Caching Application Block. Properties associated with the nodes appear in the right pane. If you are going to use the Data Access Application Block as the backing store, you must configure that application block before you configure the Caching Application Block.

To add the Caching Application Block

  1. Open the configuration file. For more information, see Configuring the Application Blocks.
  2. Right-click Application Configuration, point to New, and then click CachingApplicationBlock.
  3. The Configuration Console automatically adds the Cache Manager node with default settings.

To configure the Cache Manager

  1. Click the Caching Application Block node.
  2. (Optional) Change the DefaultCacheManager property name. The default cache manager is used if the code does not specify a specific cache manager. Either enter a new name or select one from the drop-down list. The default name is CacheManager.
  3. Click the CacheManager node (if you renamed the cache manager, the node will have the name you assigned it).
  4. (Optional) Set the ExpirationPollFrequencyInSeconds property. This is the frequency of the timer that regulates how often the background scheduler checks for expired items. The unit is seconds; the minimum time is 1 second and the default is 60 seconds.
  5. Set the MaximumElementsInCacheBeforeScavenging property. This is the maximum number of elements that can be in the cache before scavenging. The default setting is 1000 elements.
  6. (Optional) Rename the CacheManager node. The default name is CacheManager.
  7. Set the NumberToRemoveWhenScavenging property. This is the number of elements to remove after scavenging begins. The default setting is 10 elements.

By default, the cache stores items only in memory and assigns the value of the backing store to NullBackingStore. You can also configure the Caching Application Block to use database cache storage, isolated storage, or custom cache storage. Database cache storage uses the Data Access Application Block.

To configure the Caching Application Block for database cache storage

  1. Right-click CacheManager (if you renamed the cache manager, the node will have the name you assigned it), point to New, and then click DatabaseCacheStorage.
  2. The Configuration Console automatically adds the Data Access Application Block. For information about configuring this application block, see the Data Access Application Block documentation.
  3. Click the DataCacheStorage node.
  4. Set the DatabaseInstance property. This is the name of the database connection string. It must correspond to the name of a connection string in the Data Access Application Block configuration. Either enter the name or select it from the drop-down list.
  5. (Optional) Set the Name property by renaming the DataCacheStorage node.
  6. Set the PartitionName property. This identifies the portion of the database that the cache manager will use.

To configure the Caching Application Block for isolated storage

  1. Right-click CacheManager (if you renamed the cache manager, the node will have the name you assigned it), point to New, and then click IsolatedStorage.
  2. If you want to encrypt the information stored in isolated storage, right-click Isolated Storage, point to New, and click Symmetric Storage Encryption. The Configuration Console automatically adds the Cryptography Application Block. For information about configuring this application block, see the Cryptography Application Block documentation.
  3. (Optional) Set the Name property by renaming the IsolatedStorage node.
  4. Set the PartitionName property. This identifies the portion of isolated storage that the cache manager will use.

To configure the Caching Application Block for custom cache storage

  1. Right-click CacheManager (if you renamed the cache manager, the node will have the name you assigned it), point to New, and then click Custom CacheStorage.
  2. In the Attributes property section of the right pane, click the ellipsis button (...).
  3. In the EditableKeyValueCollectionEditor dialog box, click Add to add a new name/value pair.
  4. In the right pane of the EditableKeyValueCollectionEditor dialog box, enter the key name and the value of the property.
  5. Add more name/value pairs as appropriate, and then click OK.
  6. (Optional) In the Name property section located in the right pane of the Configuration Console, change the name of the custom cache storage. The default name is CacheStorage.
  7. In the Type property section of the right pane, click the ellipsis button. If the type you want is not included in the Assemblies folder, click LoadAssembly on the TypeSelector to find the assembly that contains the type you want.

If you want to add another instance of the cache, manager, right-click the CacheManagers node, point to New, and then click CacheManager. Repeat the preceding procedures. There can be only one default cache manager. Each instance of the cache manager must have a unique name.

Usage Notes

The configuration settings for the Caching Application Block should reflect both an application's caching usage pattern and its system environment, such as the amount of available memory. For example, if an application adds items to the cache at a greater rate than it removes them when scavenging (this is a configurable setting), the cache will continue grow. Over time, this can cause memory starvation. Use the application block's performance counters to help tune the configuration settings for each application.

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The latest Enterprise Library information can be found at the Enterprise Library site.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.