(Quick Reference)

block

Description

Renders a block of markup and caches the result so that the next time the same block is rendered it doesn't have to be evaluated again. Optionally, a key may be provided which can be helpful if the cached content is different per user, for example.

Note that the key's namespace is confined to this particular cached block. This means that if there are 2 separate blocks which share the same key value, the 2 will not collide with each other. Each cached block has its own set of keys.

Examples

<cache:block>
    <!-- Any valid markup may be included here, including dynamic expressions, invoking other tags, etc.... -->
</cache:block>

<cache:block key="${currentUser.id}">
    <!-- Any valid markup may be included here, including dynamic expressions, invoking other tags, etc.... -->
</cache:block>

Attributes

  • key (optional) - An optional key that may be provided to allow for different instances of the block to be held in the cache, presumably with different content.