Live Chat Icon For mobile
Live Chat Icon

How to remove the Cache starting with ‘cachedata_’

Platform: ASP.NET| Category: Output Caching

VB.NET


Dim enumerator As IDictionaryEnumerator = Cache.GetEnumerator()
While enumerator.MoveNext()
	Dim key As String = CType(CType(enumerator.Current, DictionaryEntry).Key, String)
	If key.StartsWith('cachedata_') Then
	                ’ Print it:
                	Response.Write(('Deleting key ' + key + '
'))
	                ’ Remove it:
                	Cache.Remove(key)
	End If
End While

C#


IDictionaryEnumerator enumerator = Cache.GetEnumerator();
while(enumerator.MoveNext()) 
{
	String key = (String) ((DictionaryEntry) enumerator.Current).Key;
	if(key.StartsWith('cachedata_')) 
	{
		// Print it:
		Response.Write('Deleting key ' + key + '
');
		// Remove it:
		Cache.Remove(key);
	}
}

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.