title: How to delete all objects in Azure Managed Cache Service Except Session Objects
body: <p>We are using Microsoft Azure Cache service for our cloud service which is having multiple web role and worker role instances. Managed cache is also used for storing user sessions. Everything is configured and works fine.</p>
  
  <p>Is there any way using which we can flush / clear all objects in managed cache service at once? we don't want to remove each object by it's key.
  If there is a way to do this, then how can we clear everything except user session objects?</p>
  
  <p>I am aware of API whose documentation says that it clear all objects in cache, but not sure if it works in case of managed cache service?
  <strong><em>Microsoft.ApplicationServer.Caching.Clear()</em></strong></p>
  
  <pre><code>static DataCacheFactoryConfiguration cacheFactoryConfiguration = new DataCacheFactoryConfiguration("default");
  
  static DataCacheFactory cacheFactory = new DataCacheFactory(cacheFactoryConfiguration);
  
  static DataCache cache = cacheFactory.GetDefaultCache();
  
  cache.Clear();
  </code></pre>