Document Caching

Document caching ensures that a template/data pair is rendered once and only once for the lifetime of the Set instance.

Set implements several levels of caching that is automatic. These are:

In addition, you may optionally opt in for document caching. To do so, include the following Set directive in your data:

data = {…, __set: {cache: true}}

When you turn on document caching, any template/data pair will only be rendered on first requiest.

Note: it is best to use document caching on pages where the data is expected not to change often so as to avoid excessive memory usage due to the cache. A perfect use case is for mostly static / infrequently updated pages that use partials.

Express 3 router (node.js)

exports.route = (request, response) ->
  data = 
    title: ' Labs: Set: Cached Documents'
      cache: true   # Use the document cache

  response.render 'cached-documents', data