In attempting to get specific views max-age time values working, I discovered that Viewfield sets 'max-age' => 0 on every content type using a viewfield, no matter whether an actual view was rendered or not. This caused all content types using a Viewfield to become non-cacheable when relying on cacheable metadata.

Suggest removing the cache max-age entirely, as it appears that $view->buildRenderable($display_id, $arguments) is handling the cache settings on #content, or at least moving the max-age setting to be within the if (!empty($view->result) || $always_build_output) section to avoid having it set all of the time, even when there is no rendered view.

CommentFileSizeAuthor
#2 remove-max-age-2879222-2.patch683 bytesaveldina

Comments

aveldina created an issue. See original summary.

aveldina’s picture

StatusFileSize
new683 bytes

Patch attached removes 'max-age' => 0, from $elements.

keithm’s picture

Title: Viewfield always forces max-age to zero. » Design and implement a caching strategy
maxilein’s picture

Priority: Normal » Major

Given the possible impact on performance.

chris burge’s picture

Status: Active » Needs review
jerdavis’s picture

This was included in another patch/issue.

jerdavis’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

kopeboy’s picture

So how was this solved? I can't find any documentation about a caching strategy, which is pretty important given the potential impact of this module. Do linked Views use the existing cache across hosting entities if they don't have active (host-specific) contextual filters?
Thank you

chris burge’s picture