Caching

To cache a resource forever by clients, just add the query parameter o1-cache with a unique value to its URL when referencing it. The value must change any time the response changes, otherwise it won’t be loaded.

This is a global feature, meaning that Boomla will extend the response headers for any HTTP/HTTPS request if the o1-cache query parameter was found, regardless of its value.

Caching images

You can embed an image with:

<img src="/image.jpg?o1-cache=021cc4f73cbca32878a09448ae338b0292c41869">

Notice that the value of o1-cache, in this case 021cc4f73cbca32878a09448ae338b0292c41869 must be generated from the contents of the image. So, hard wiring that value in a HTML file would be a bad idea. Instead, if you write an sjs-3 app, you could use the following code:

img = f.select('/image.jpg')
p += '<img src="' + img.path() + '?o1-cache=' + img.fileHash() + '">'

Of course, when you are at it, you should add the alt text as well:

img = f.select('/image.jpg')
alt = util.htmlEncode(img.title())
p += '<img src="' + img.path() + '?o1-cache=' + img.fileHash() + ' alt="' + alt + '">'