Recently I was asked if there is a way to clear all of objects in the Windows Azure Caching Service or in otherwise clearing/flushing all objects from Windows Azure AppFabric Cache from a single call or what is the best way or recommended way to clear all cached objects.

 

What I found is that the current implementation of Windows Azure Caching Service (AppFabric Cache) does not have a single API to clear all the cache objects. The one thing to note here is that if you do not set a lifetime for the objects when you put them in the cache, then by default the item will be cleared after 48 hours. So this is the normal time your cache object will be deleted. Now if you want to have finer control on clearing the cache objects, you can:

-           keep track of your keys or manually deprovisioning/reprovisioning the cache.

-           You can also setup a lifetime objects you put into the cache