diff --git a/docs/en/reference/partial-caching.md b/docs/en/reference/partial-caching.md index 8855cd93b..6736a9327 100644 --- a/docs/en/reference/partial-caching.md +++ b/docs/en/reference/partial-caching.md @@ -58,11 +58,10 @@ To help do this, SilverStripe introduces the concept of Aggregates. These calcul on sets of `[api:DataObject]`s - the most useful for us being the Max aggregate. For example, if we have a menu, we want that menu to update whenever _any_ page is edited, but would like to cache it -otherwise. By using aggregates, that's easy +otherwise. By using aggregates, we can do that like this: :::ss - <% cached 'navigation', List(Page).max(LastEdited) %> - + <% cached 'navigation', List(SiteTree).max(LastEdited) %> If we have a block that shows a list of categories, we can make sure the cache updates every time a category is added or edited @@ -70,14 +69,12 @@ edited :::ss <% cached 'categorylist', List(Category).max(LastEdited) %> - We can also calculate aggregates on relationships. A block that shows the current member's favourites needs to update whenever the relationship Member::$has_many = array('Favourites' => Favourite') changes. :::ss <% cached 'favourites', CurrentMember.ID, CurrentMember.Favourites.max(LastEdited) %> - ## Cache key calculated in controller That last example is a bit large, and is complicating our template up with icky logic. Better would be to extract that