mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
parent
646d34ec48
commit
d2c0b98bc5
@ -209,8 +209,8 @@ could also write the last example as:
|
|||||||
<% end_cached %>
|
<% end_cached %>
|
||||||
|
|
||||||
<div class="warning" markdown="1">
|
<div class="warning" markdown="1">
|
||||||
Currently cached blocks can not be contained within if or loop blocks. The template engine will throw an error
|
Currently a nested cache block can not be contained within an if or loop block. The template engine will throw an error
|
||||||
letting you know if you've done this. You can often get around this using aggregates.
|
letting you know if you've done this. You can often get around this using aggregates or by un-nesting the block.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
Failing example:
|
Failing example:
|
||||||
@ -219,7 +219,7 @@ Failing example:
|
|||||||
<% cached $LastEdited %>
|
<% cached $LastEdited %>
|
||||||
|
|
||||||
<% loop $Children %>
|
<% loop $Children %>
|
||||||
<% cached LastEdited %>
|
<% cached $LastEdited %>
|
||||||
$Name
|
$Name
|
||||||
<% end_cached %>
|
<% end_cached %>
|
||||||
<% end_loop %>
|
<% end_loop %>
|
||||||
@ -239,6 +239,19 @@ Can be re-written as:
|
|||||||
|
|
||||||
<% end_cached %>
|
<% end_cached %>
|
||||||
|
|
||||||
|
Or:
|
||||||
|
|
||||||
|
:::ss
|
||||||
|
<% cached $LastEdited %>
|
||||||
|
(other code)
|
||||||
|
<% end_cached %>
|
||||||
|
|
||||||
|
<% loop $Children %>
|
||||||
|
<% cached $LastEdited %>
|
||||||
|
$Name
|
||||||
|
<% end_cached %>
|
||||||
|
<% end_loop %>
|
||||||
|
|
||||||
## Cache expiry
|
## Cache expiry
|
||||||
|
|
||||||
The default expiry for partial caches is 10 minutes. The advantage of a short cache expiry is that if you have a problem
|
The default expiry for partial caches is 10 minutes. The advantage of a short cache expiry is that if you have a problem
|
||||||
|
Loading…
Reference in New Issue
Block a user