开发者

Play Framework: caching on templates

I'm using Play Framework (v1.1.1) and I have a doubt about the #{cache} tag.

I suppose the question would be "when should I use it?" but I think it's quite generic.

So besides that, I would like to know if someone has checked its behaviour with Javascript. I understand that it will cache the output of other tags embedded in its body, but it will also cache Javascript? More 开发者_Go百科specifically, if I include some script tags that reference external resources (like a CDN), the file will get cached too or only the tag?


The purpose of the Cache tag is to cache the output that the server sends to the client. Javascript, images and any other information that is contained within the code sent to the client side is not cached, unless specifically told to do so by the headers set in the tag of your HTML.

By default, Play (if you extend the main.html) does not specify any cache-control headers, so therefore your scripts will be cached based on the browsers standard caching policy. This should be "no-cache" according to the http spec, but I am doubtful of whether this is the case.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜