热门关键字:
jquery > jquery教程 > .net > .net(C#)清空所有缓存Cache的方法

.net(C#)清空所有缓存Cache的方法

4681
作者:管理员
发布时间:2014/3/26 9:45:54
评论数:0
转载请自觉注明原文:http://www.jq-school.com/Show.aspx?id=412
    /// <summary>
    /// 清空所有的Cache
    /// </summary>
    public static void ClearCache()
    {
        List<string> cacheKeys = new List<string>();
        IDictionaryEnumerator cacheEnum = HttpContext.Current.Cache.GetEnumerator();
        while (cacheEnum.MoveNext())
        {
            cacheKeys.Add(cacheEnum.Key.ToString());
        }
        foreach (string cacheKey in cacheKeys)
        {
            HttpContext.Current.Cache.Remove(cacheKey);
        }
    }




如果您觉得本文的内容对您的学习有所帮助:支付鼓励



关键字:.net C# 缓存 Cache
友荐云推荐