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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:51:12+00:00 2026-05-11T06:51:12+00:00

I am developing a web app using ASP.NET 2.0 (C#), where on home page

  • 0

I am developing a web app using ASP.NET 2.0 (C#), where on home page I am displaying recently added records. Adding of records frequency is around 1-5 records per day, so I decided not to put much overhead on the sql server by fetching recent records every time from db server.

So, To make the data cached I have used XML files, I have generated the XML file from dataset, (ds.WriteXML function in .NET), now lets say today (10 Jan 2008 12:30:00) I have created a file recent-cache.xml is created. So, the recent cache file is valid for one day.

Then if the difference between current date and last modified date is greater than or equal 1 day then cache xml file must be generated again, with the new data from the db server.

So, I want the code using which I can get the last modfied date of the xml file and then find the difference between both (current and file last modified-date) dates.

And also please tell me what I thought is the better solution, or we can do anything else, some other easy and speedy technique.

Thanks

  • 1 1 Answer
  • 1 View
  • 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. 2026-05-11T06:51:12+00:00Added an answer on May 11, 2026 at 6:51 am

    You might consider using the ASP.NET Cache API, which exists to do the sort of job you’re describing. You can add any object (like an XmlDocument, or a DataSet) to the Cache collection and specify how long you want it in there like so:

    Cache.Insert('MyCacheKey', myObjectToCache, null, DateTime.Now.AddDays(1), null); 

    Then you could get at your cached data with a function like this:

    const string CACHE_KEY = 'MyCacheKey';  private DataSet RecentlyAdded() {     if(Cache[CACHE_KEY] == null)         Cache.Insert(CACHE_KEY, GetRecentlyAddedFromDatabase(), null, DateTime.Now.AddDays(1), null);     return Cache[CACHE_KEY]; } 

    The caching API has lots of other neato features but this would accomplish what you want without having to roll your own file-based solution.

    Note that if your app shuts down before the day is up, the Cache will shut down with it, and the ‘recently added’ database query will have to run again the next time the data is requested.

    edit: changed cache key to a string constant so it only has to be specified once.

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

Sidebar

Ask A Question

Stats

  • Questions 119k
  • Answers 119k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Add a System.Windows.Forms.ContextMenuStrip item to the form, then set the… May 11, 2026 at 11:57 pm
  • Editorial Team
    Editorial Team added an answer You can add a class to all the links that… May 11, 2026 at 11:57 pm
  • Editorial Team
    Editorial Team added an answer To catch that error specifically, change your code to look… May 11, 2026 at 11:57 pm

Related Questions

I'm a total newbie to SVN and haven't been able to find an answer
I am developing an ASP .Net MVC application and on my dev machine, the
I'm developing an Asp.Net 3.5 application and I need to print some application generated
I am making this in a proactive attempt to head off any potential problems

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.