谷歌建议如何在客户端缓存查询?
好吧,我正在使用 Google 查询自动完成功能,并注意到有趣的事情:例如,如果我输入“m”字母,它会执行 Ajax jsonp 查询。然后,如果我刷新页面并再次输入“m”字母,则不会有任何查询。对于较长的字母序列也会发生同样的情况。
很明显,Google 使用了一些客户端缓存。我非常肯定它不会在 cookie 中存储任何内容。我知道一些技术可以在客户端缓存大量数据以供 JS 使用,但我想知道 Google 使用哪一种技术?
他们的代码非常混乱,我需要一些时间才能自己找到答案,所以如果有人向我指出任何有关 Google 的最新文章建议回答我的问题,我会非常感激。
Well, I was playing with Google query auto completion and noticed funny thing: if I for example type in "m" letter, it performs Ajax jsonp query. Then if I'll refresh my page and enter "m" letter again there would not be any query. The same thing happens with longer sequences of letters.
It's obvious that Google uses some client-side caching. And I'm quite positive that it doesn't store anything in cookies. I know some technologies that allow to cache large amounts of data on client side for JS use, but I'd like to know which one Google uses?
Their code is awfully obfuscated and it'll take me some time to find the answer by myself, so if someone will point me any descent up to date article about Google suggest that answers my question, I'd be very grateful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
浏览器负责处理缓存。 Google 只是实现所有相关标头(例如
Expires
)以确保脚本正确缓存,然后下次请求时浏览器会从缓存中获取它。没有花哨的技巧或谷歌魔术:-)编辑:我能找到的最佳链接是 http://code.google.com/speed/page-speed/docs/caching.html。也许其他人可以指出一些其他链接。
It's the browser that handles the caching. Google just implement all the relevant headers (eg
Expires
) to make sure the script is cached correctly, then the next time it's requested the browser fetches it from the cache. No fancy tricks or google magic going on :-)EDIT: Best link I could find was http://code.google.com/speed/page-speed/docs/caching.html. Maybe someone else can point out some other links.