HttpContext.Current.Cache 和 HttpRuntime.Cache 区别

HttpContext.Current.Cache 只可能用于 Web 应用的缓存

适应的地方:

public static void UserHashByMap(int uId)

{

    HttpContext.Current.Cache["xx"] != null

}

 

HttpRuntime.Cache 可用于非 Web 应用的缓存,不然用 HttpContext.Current.Cache ,是无法获得web下存储的Cache

适应的地方:

public static void RefreshCacheByTimer(object sender, ElapsedEventArgs e)

{

    HttpRuntime.Cache["xx"] != null

}

posted @ 2010-03-02 15:52  王翔(kingfly)  阅读(315)  评论(0编辑  收藏  举报