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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:31:19+00:00 2026-06-12T06:31:19+00:00

In my project, we use web services to get data from the DB and

  • 0

In my project, we use web services to get data from the DB and populate the data from web services to cache.
I am using Absolute expiration , and the duration is set to 4 hours.
So after 4 hours, cache expires and therefore the web service is called to re populate the data in the cache.

The problem happening now is :

Sometimes there is a problem establishing connection between web services and database and therefore the web services does not return data.

In this case the cache is populated with null values for all fields and up to 4 hours cache (up to the time it expires again) it is not re populated.

I am looking for 2 types of solutions:
1)we could renew the cache before it expires, then call the web service. If the web service gets data back, overwrite the cache.
2) the cache never expires and every so often we spawn a thread which updates the cache if we get data back.

But I am not sure how to implement the above solutions? Can somebody give me insight on technical part? Thanks for the help!

MY current code of populating cache :

ctx.Cache.Insert("cachename", cacheValue, null,
              DateTime.Now.AddHours(Int32.Parse(siteViewModel.ApplicationSettings["CacheDurationHours"])), System.Web.Caching.Cache.NoSlidingExpiration, 
             System.Web.Caching.CacheItemPriority.Default,
             null
             );
  • 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-12T06:31:20+00:00Added an answer on June 12, 2026 at 6:31 am

    Instead of passing null, implement a CacheItemRemovedCallback as the last parameter to Cache.Insert(..). When retrieving the value
    to repopulate the cache, you can do a null check and use the old value for the time being.

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

Sidebar

Related Questions

Alright so I'm using Microsoft's Web Services and AJAX to get information from a
In my iPhone project,I use Odata Service to get data from SQL Server database
How can I get data from an xml web service (say, the value of
I have started a new mvc project and clicked on project\properties\web - use local
I am attempting to use the Web Deployment Toolkit with our MVC3 project and
I have inherited a web site project that makes use of a number of
In my web project, I use DocX file type for containing report template. I
On a web project for a client, we want to use a type of
I am trying to use a Java project called Search in my another Web
I'm trying to create a web application project template for everyone to use here

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.