Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7842489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:20:01+00:00 2026-06-02T16:20:01+00:00

I have been reading a bit about caching in c# 3.5. Got a bit

  • 0

I have been reading a bit about caching in c# 3.5. Got a bit confused and would appreciate clarification on elaborating what is the difference between

HttpContext.Current.Cache vs HttpRuntime.Cache vs System.Web.Caching.Cache

Also, I have read using any of the above in non-web application is not recommended but it works. What are the drawbacks?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T16:20:02+00:00Added an answer on June 2, 2026 at 4:20 pm

    System.Web.Caching.Cache is the type which implements the cache for a Web application. HttpContext.Current.Cacheis just a wrapper and return HttpRuntime.Cache which is nothing but instance of System.Web.Caching.Cache.

    Update

    Refer to Is it OK to use HttpRuntime.Cache outside ASP.NET applications? for your second part.

    Update: Why HttpRuntime.Cache needs to be wrapped?

    In my Personal Opinion, HttpContext is the type which gets passed to IHttpHandler.ProcessPostBack and HttpApplication exposes HttpContext which is passed IHttpModule.Init. This would ensure all the dependencies are injected using Method injection. Hence they introduced a level of indirection.

    The Handlers and Modules should be ignorant of the HttpRuntime on which they are hosted. While you are in a ASP.NET page, it is advisable to use this.Page.Cache instead HttpContext.Current.Cache or HttpRuntime.Cache as using HttpContext.Current would involve a overhead of resolving the current thread and HttpRuntime.Cache would create an external dependency. Page.Cache is initialized with the HttpContext.Cache which is passed to ProcessRequest

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been reading about the differences between Table Variables and Temp Tables and
I have been reading about bit operators in Objective-C in Kochan's book, Programming in
I've been reading up a bit about coffeescript's inheritance model and I have the
I have been reading a bit about Web Matrix, I like the simpleness of
I have been reading quite a bit recently about TDD and such and I'm
Have been reading about async and tasks and been attempting to convert the CopyFileEx
I have been reading through the C++ FAQ and was curious about the friend
Been reading a bit about the subject, and out of curiosity, online games which
I've been reading a bit about functional programming recently and am keen to get
I've been reading a bit about this recently but it looks to be a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.