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 8808207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:33:49+00:00 2026-06-14T02:33:49+00:00

I have asp net website with a very slow query on a remote database.

  • 0

I have asp net website with a very slow query on a remote database. To address that problem I use caching in Application_Start.

HttpRuntime.Cache["Folders"] = (from f in db.Folders select f).ToList();

in the controller

var folderList = (List<Folder>)HttpRuntime.Cache["Folders"];

It takes quite an amount of time to load the website the first time but when it’s up it’s fast. I also use the new serverAutoStart=”true” feature of IIS so the website is always running with the Cache loaded. Even if the application pool restart IIS will load the website in a new W3wp process and switch the processes when the new instance is loaded. Resulting in no downtime or slow starting up.

But now I would like to reload the cache when some controller action occurs. So is it possible to reload it asynchronously without blocking all the website or the session that triggered the action while reloading it ? Also I would like that the current Cache[“Folders”] still works during the operation.

  • 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-14T02:33:50+00:00Added an answer on June 14, 2026 at 2:33 am

    You can make use of Parallel Tasks

       var repopulateCache = new System.Action(() => RepopulateCache(someParameter);
       Task.Factory.StartNew(repopulateCache);
    

    It is recommended to know what you are doing before using this, try reading some background information.

    That said, I’ve had this in production for a while and it works very well and means you don’t have to worry (too much) about the usual perils of threading. It willl create background work on your web server but in your case it doesn’t sound like a big risk.

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

Sidebar

Related Questions

I have a ASP.NET website deployed to IIS with a couple of ashx that
I have an asp.net website that has been running well in IIS 6.0. I
I have legacy asp.net 1.1 website. It has a very poor VB layered achitecture.
I have an ASP.Net website which uses a MySQL database for the back end.
I have the following: ASP.NET website using the 3.5 framework One folder that contains
I have an ASP.NET website that has been deployed since 2008 with plenty of
I have an asp.net website which contains a Thread that fetches some data from
I use ASP.NET website on IIS7 where in web.config I have: <sessionState mode=InProc timeout=20></sessionState>
I have an asp.net website that uses forms authentication. There are a few things
I have an existing ASP.NET MVC based website. Very typical: XHTML, CSS, jQuery, C#,

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.