代码以清除图像缓存 [英] code to clear image caching

查看:91
本文介绍了代码以清除图像缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以向我提供清除图像缓存的代码吗?

Can anyone please provide me the code to clear image caching

推荐答案

ASP.NET带有非常强大的缓存机制,可用于轻松提高响应速度和效率.您的Web应用程序.

这是清除Web应用程序中所有缓存数据的代码片段:

ASP.NET comes with very powerful caching mechanism that can be used to easily improve responsiveness and efficiency of your web applications.

Here is the code snippet that clears all cached data in your web application:

public void ClearApplicationCache()
{
    List<string> keys = new List<string>();
    // retrieve application Cache enumerator
    IDictionaryEnumerator enumerator = Cache.GetEnumerator();
    // copy all keys that currently exist in Cache
    while (enumerator.MoveNext())
    {
        keys.Add(enumerator.Key.ToString());
    }

    // delete every key from cache
    for (int i = 0; i < keys.Count; i++)
    {
        Cache.Remove(keys[i]);
    }
}


这篇关于代码以清除图像缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆