Cache large volume of json result on client side

前端 未结 3 433
梦谈多话
梦谈多话 2021-02-05 23:39

I\'ve a asp.net mvc application which returns the JSON result containing upto n number of years worth of data which then gets rendered on Javascript chart.

In order to h

3条回答
  •  野性不改
    2021-02-06 00:10

    1. Retrive the data from database and save as a static file at server. Give a .css or .png extension. (Browser will automatically cache the stylesheet and image files.).
    2. Save the data filename with timestamp in a hidden field.( to make sure loading the latest file from server if there is a change to the file)
    3. Load the file from server using AJAX, First time it will load from server, but next time it will load from browser cache.
    4. You can use JSON.Parse() to Parse AJAX request result.

提交回复
热议问题