Walkthrough: Removing Items From the Cache

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.

This walkthrough demonstrates how to remove items from the cache.

To reproduce this demonstration

  1. Configure the cache. For the necessary steps, see "QuickStart Configuration" in Caching QuickStart.
  2. Declare a member variable for the CacheManager object in the QuickStartForm class.
    private CacheManager primitivesCache;
    
    
    Private primitivesCache As CacheManager
    
    
  3. In the method that responds to the user's request to remove an item from the cache, add the following code.
    // Prompt the user for the key of the item to be removed.
    if (this.selectItemForm.ShowDialog() == DialogResult.OK)
    {
      // Request that the item be removed from the cache. 
      this.primitivesCache.Remove(selectItemForm.ItemKey);
    }
    
    
    ' Prompt the user for the key of the item to be removed.
    If (Me.selectItemForm.ShowDialog() = DialogResult.OK) Then
      ' Request that the item be removed from the cache. 
      Me.primitivesCache.Remove(selectItemForm.ItemKey)
    End If
    
    

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.
Show: