Retry Feature - 7.x

Summary

New for Cache release 6.8, both the Cache Macro and the Future Macro support a retry capability. This is an advanced feature where the cache and future macros can react in a more useful manner when the rendering of the macro body indicates certain types of errors that are likely caused by a temporary condition with an underlying macro or external service. The goal is to make it more likely that meaningful data is shown on the page at any point in time.

For example, the SQL macro may determine that a database is temporarily not available and indicate a retry is possible. In the case of the cache macro, it attempts to show previously cached data, if available, instead of showing the temporary error. Then, on the next render request, the rendering is retried. 

Related Issues

key summary type created updated due assignee reporter priority status resolution
Loading...
Refresh

Details

This feature is available when the rendering of the macro body indicates a temporary error condition has occurred during the rendering. This requires underlying macros to be enabled to report this type of error so that the cache or future macro can behave differently. For instance, the SQL macros (with release 7.0) have been enabled to do this for certain temporary errors.

Cache Macro

The Cache Macro uses previously cached data (that may be stale) if it is available instead of showing the error from the rendering. More importantly, the next request for the cache macro managed data results in a new request to render the macro body in the hope that the rendering can be error free and return meaningful data. Without this support being enabled, the error rendering would have been shown until the cache expired.

By default, this support is enabled. However, a new retry parameter on the Cache Macro can control this behavior. The parameter defaults to Default which recognizes a setting of an administrator controlled value that defaults to Enable.

Future Macro

The Future Macro does not show the error data. Instead, it retries rendering the body after waiting a certain amount of time specified by the retryInterval parameter on the macro. The retryInterval parameter defaults to Default which recognizes a setting of an adminstrator controlled value that sets the number of seconds to wait. This means that the loading message will continue to show until good data is retrieved. 

The retry logic is controlled by the client page and stops as soon as the page is no longer being shown.

Use Both Future and Cache

A standard, recommended approach for improving the user experience and performance of accessing external data is to use the Cache Macro inside of a Future Macro. This approach works extremely well when both future and cache are enabled for the retry feature! The expected (error free) data is cached when it is available and automatically shown on the page at that time.