Caching issue with javascript and asp.net

Posted by Ed Woodcock on Stack Overflow See other posts from Stack Overflow or by Ed Woodcock
Published on 2010-03-15T12:59:10Z Indexed on 2010/03/15 12:59 UTC
Read the original article Hit count: 240

Filed under:
|
|
|

Hi guys:

I asked a question a while back on here regarding caching data for a calendar/scheduling web app, and got some good responses. However, I have now decided to change my approach and stat caching the data in javascript.

I am directly caching the HTML for each day's column in the calendar grid inside the $('body').data() object, which gives very fast page load times (almost unnoticable).

However, problems start to arise when the user requests data that is not yet in the cache. This data is created by the server using an ajax call, so it's asynchronous, and takes about 0.2s per week's data.

My current approach is simply to block for 0.5s when the user requests information from the server, and cache 4 weeks either side in the inital page load (and 1 extra week per page change request), however I doubt this is the optimal method.

Does anyone have a suggestion as to how to improve the situation?

To summarise:

  • Each week takes 0.2s to retrieve from the server, asynchronously.
  • Performance must be as close to real-time as possible. (however the data is not needed to be fully real-time: most appointments are added by the user and so we can re-cache after this)
  • Currently 4 weeks are cached on either side of the inial week loaded: this is not enough.
  • to cache 1 year takes ~ 21s, this is too slow for an initial load.

© Stack Overflow or respective owner

Related posts about caching

Related posts about JavaScript