开发者

How to cache images which are diplayed with ajax

I'm creating chat. This chat is refreshing every 2 seconds but in messages cold be images.

They reloading every 2 seconds. How to cache images or something li开发者_运维知识库ke this?


You should not be concerned about caching. Almost all modern browsers automatically cache the resources. If you inspect the images you can see that the status will be

Not Modified 304

Explanation here: http://www.w3.org/Protocols/HTTP/HTRESP.html ( at bottom )

That being said, if your application is enterprise level this becomes a different ball game altogether. With huge traffic you should resort to techniques like

  1. Content Delivery Networks
  2. HTML Compression
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜