weixin_33701251 2019-12-03 10:19 采纳率: 0%
浏览 194

提取静态数据的最佳方法

Consider I have a zoo app that shows all the zoos for each city. Each city is a page with a list of zoos. In my current solution, on each page, I have ajax call to the server that pulls the list of the zoos for that particular city.

The performance is extremely important for me and my thought was to remove the ajax call and replace it with a JSON object that will live in the app. That way I will save a call to the server and I believe the data will arrive faster.

Is this solution makes sense? There are around 40 cities with ~50 zoos for each. Consider the data is static and will never change.

  • 写回答

2条回答 默认 最新

  • weixin_33725239 2019-12-03 11:02
    关注

    Since 900 records is not much **, you can get all the records at once during the initial load and filter the all records array by city, that way your user experience would be much smoother, since client side js processing is far better than n/w latency.

    ** - note: strictly considering the data set size of ~900

    Other solution can be - cache the data in the session scope and when ever there is a specific request for a city check for the availability in session scope, if it's not there make a n/w call.

    评论

报告相同问题?