A Helmet-like HOC without content implements SPA routing-level caching, manner without additional configuration.
The PreRender
provides a set of configuration for controlling caching rules, expiration times, caching algorithms, and more.
interval
: set the time the cache keep fresh, seconds. During this time, the cache will be used directly and not invoke asynchronous rendering.staleLimit
: sets the time when the cache is completely expired, seconds.During this time, The cache can be returned and asynchronous rendering will be invoke, otherwise must wait for the re-rendered result.level
: sets the calculation rule level for the cache identity, usually used with includes
and matches
. The default value is 0
.includes
: sets the content that needs to be included in the cache identifier, used when the level
is not 0
. The default value is null
.matches
: sets the rewriting rule for the value of query or header in cache identity, usually used in cache category, supports regular expressions. The default value is null
.The following example shows how to add the parameters in the query and header into the cache identifier calculation:
The following example shows how not to let the test channel affect the online cache: