衫裤跑路 2011-02-08 19:35 采纳率: 50%
浏览 26

为什么用jQuery缓存AJAX?

I use jQuery for AJAX. My question is simple - why cache AJAX? At work and in every tutorial I read, they always say to set caching to false. What happens if you don't, will the server "store" such requests and get "clogged up"? I can find no good answer anywhere - just links telling you how to set caching to false!

  • 写回答

7条回答 默认 最新

  • weixin_33681778 2011-02-08 19:37
    关注

    The main problem with caching requests in any kind of dynamic environment is that you'll get stale data back some of the time. And it can be unpredictable when you'll get a 'fresh' pull vs. a cached pull.

    If you're pulling static content via AJAX, you could maybe leave caching on, but how sure are you that you'll never want to change that fetched content?

    评论

报告相同问题?