Validate cached wrapper support for null cache keys
chrispenny opened this issue · 1 comments
I was originally under the impression that providing a value of null
to the <% cached %>
wrapper was equivalent to using an <% uncached %>
wrapper. It sounds like this might not be the case though.
Need to validate what the behaviour is of the <% cached %>
wrapper is when a value of null
is provided to it.
The workaround (for now) is to conditionally add/avoid the <% cached %>
wrapper depending on whether $CacheKey
returns a value or not.
It looks like $CacheCondition
for the <% cached %>
wrapper has been available since Silverstripe 4.7
.
https://docs.silverstripe.org/en/4/developer_guides/templates/partial_template_caching
I think the solution would be for us to update the recommended installation docs to reflect this. Something like:
<% cached $CacheKey if $CacheKey %>
But then we should also add some sort of option in the docs for folks using < 4.7
.