Controlling caching of external files with the content-rewrite feature
by Eiji Kitamura
In my recent article about caching, I wrote that the content-rewrite function cannot be used in the PHP version of Shindig, but it appears that it has already been implemented in the 1.0.x version.
Although the content-rewrite function was proposed for OpenSocial 0.9, it appears that it can also be implemented in 0.8 and 0.7.
Here's how to use it.
<Optional feature="content-rewrite"> <Param name="expires">86400</Param> <Param name="include-url"></Param> <Param name="exclude-url">excluded</Param> <Param name="exclude-url">more excluded</Param> <Param name="minify-css">true</Param> <Param name="minify-js">true</Param> <Param name="minify-html">true</Param> </Optional>
- expires: Specifies the cache expiration time in seconds. The default is 86400 seconds (24 hours).
- include-url: Specifies the URL of external content you want to cache. You can use asterisks (*). For example, ”.gif”, it will be assumed to have an asterisk before and after it. Repeatable.
- exclude-url: Specifies the URL of external content you do not want cached. The method of application is the same as for include-url.
- minify-css: Specifies whether to compress and cache the contents of CSS files using ”true” or ”false”. The default is ”true”
- minify-js: Specifies whether to compress and cache the contents of JS files with ”true” or ”false”. The default is ”true”
- minify-html: Specifies whether to compress and cache the contents of HTML files with ”true” or ”false”. The default is ”true”
exclude-url takes precedence over include-url. ”*” specifies all URLs. Detailed behavior is container-dependent.
This will make development a little easier.
Subscribe via RSS