Field Caching

Bloqs offers field caching, which will cache the final output of a single Bloqs field in a template. Enabling caching will decrease page load time by rendering cached content, thus avoiding the additional parsing necessary to render all the custom field data from the atoms inside each bloq.

Bloqs is a complicated add-on. If you have an entry with a Bloqs field that has 10 bloqs, and each bloq has 5 atoms (custom fields), you're effectively rendering 50 fields to in a template. If each of those 10 bloqs has a Relationship field, then you're rendering 10 Relationship fields on the front-end of your site. These complicated field types (any fieldtype that is not a basic text, textarea, wysiwyg, radio, checkbox etc) can add considerable overhead. Below is an example of a profiling output from a cached and uncached Bloqs field render:

# Uncached rendering time in seconds
Bloqs Replace Tag: 3.1513
# Cached rendering time in seconds
Bloqs Replace Tag: 0.0086

When an entry is saved, the corresponding cache item will be deleted. The next time the field is rendered on the front-end, a fresh cache item will be created.

$config['bloqs_cache_enabled'] = true;

When displaying a cached Bloqs field on the front-end, it will be wrapped in the following html comment tags:

<!-- Start cached Bloqs output -->... Your bloqs content here ...<!-- End cached Bloqs output -->

The only way to clear a cached item is to re-save an entry, or clear the cache manually. If a site is actively being developed, it is probably best to not enable caching because making changes to template files will not clear the cache, thus you may not see the most up-to-date content. Enable cache in production sites only.