Orchard Harvest 2017: when output cache just isn’t enough
Daniel Stolt and Chris Payne from IDeliverable presented some new output caching techniques that they’ve developed. The problem that they’re solving is what happens when you have to output user-specific data into rendered contents. In those cases, you want to cache the constant parts of the output, while keeping holes dynamic. This is known as donut caching.
The holes in the donuts can be puched into rich text using a placeholder with the %%{name} notation. Those placeholders are not exactly tokens, but behave similarly, and are also extensible.
They also have an item-level cache part that can be added for instance to widgets, and used to set the output cache policy for that specific item, or to exclude it from the cache altogether. The item-level cache configuration is very rich, and allows for very fine-grained control. This can even be extended with your own “vary by” providers.
Cached output is stored into the same place as Orchard’s built-in output cache. This means that any provider that already exists can be used without changes.
The module also introduces some new options to evict pages that use a given widget, that gives a lot more control than the built-in feature. For instance, if you have a menu widget on all your pages, you don’t want just any change on the menu to cause the eviction of every single page in the site from output cache.
It’s possible to cache summary versions of items, such as the ones in search results. In this case, individual items in a results list, if they are in the cache, do not need to be re-rendered, but can come from the cache. This is quite neat as the caching structure of the page in this case is nested.
Finally, it is possible to trigger pre-rendering of an item into the output cache whenever it gets evicted (on a change, typically).
IDeliverable’s donut caching module is a premium module that can be tried for free on localhost, bought, or subscribed to.