Homepage cached, but some parts not cached

On our homepage, we would like to have the main content to be cached. But some parts, such as current news, weather, main picture, etc will need to be dynamic, and therefore not cached. How can I cache certain parts of our homepage, but leave some parts with no_cache?

Even if certain parts of your homepage are dynamic, you still want to be caching them, otherwise you'll put an unnecessary load on your server.


What you really want to do is cache everything, but clear the cache on the dynamic elements of your homepage when they get updated (or at least more regularly).



You can potentially setup triggers to do this, depending on your setup.


So, maybe something like this:

Events: Asset Updated
[b]Conditions:[/b]
Asset is type - Asset Listing Page
Tree Location - (specific location)
[b]Actions:[/b] Clear matrix cache

Would something like that work? Or would it have to be a little more complex to clear the cache for nested content?

That reads about right. You may want to add a condition that the status of the asset should be live as well.


AFAIK, you will also need to clear the cache on the homepage which nests the asset listings, which I don't think can be done with triggers. Someone feel free to correct me if I'm wrong on both counts :slight_smile:

If the homepage nests the content, then it needs to be cleared. I think the newer version of the clear cache trigger action (maybe 3.12) allows you to pick any asset to clear it on, so this can be done.


If the nesting is done using design areas, just turn caching off for them (use cache="no" in the design area tag). The design area wont cache, but the page being nested still will, so no real performance problems there.


Which is better, Nesting using design areas, or nesting within the body copy of page? What are the pros and cons?

[quote]Which is better, Nesting using design areas, or nesting within the body copy of page?  What are the pros and cons?
[right][post=“14791”]<{POST_SNAPBACK}>[/post][/right][/quote]



For your purpose, using design areas is probably more appropriate. Other than caching which Greg has just mentioned, just like other design areas, you can create customisations of you design, and for example, change which asset is being nested in the design.



On the downside, it’s probably slightly more difficult to change which asset(s) are being nested with a design customistation, but only slightly :slight_smile:

I am still slightly confused about how to add a custom design area, and how I would nest an asset listing in it. Could you provide some sample code for me to start with?

Check the Design Manual for the Nest Content Design Area. That will give you example code.


Then you need to create a customisation, and customise that design area on the details screen of the customisation. Once you have done that, you can click a link on that details screen to view the design area's settings.



There, you can select the asset to nest into your design.


That is what I was looking for! I has been in the design manual for a while, but was looking in the wrong place.

Thanks.

Double posting to ask why there are two separate ways to nest content? They seem to have the same result.


Also, if I have 2 different design customizations within the same design, how can I have both of them show up? Such as having a nest_content area and a js_calendar? If I have to set one of them as my System Defined Frontend Design, that means one of them will not show up, what if I want both?

The two have the same result, but in different places. With a Nest Content design area, you can nest content outside the body, which is where a Nested Content DIV works.


Also, you can customise more than one design area in each customisation. If you've already got a customisation for js_calendar, just go to its details screen and chose to customise the nest_content design area as well. :slight_smile: