eZ Community » Forums » eZ Publish 5 Platform » Setting Shared Max Age in a custom...
expandshrink

Setting Shared Max Age in a custom view Controller

Setting Shared Max Age in a custom view Controller

Tuesday 23 September 2014 12:01:34 pm - 3 replies

hi there. 

Im my project i've added a controller for displaying contents of a specific type, in this case "products". This is the related piece of yml file

Among other things, in this controller i'm trying to increase sharedMaxAge for this kind of contents

So, i'm doing something like

But, when i see headers for product pages, i always see sharedMaxAge being 60 (the default one if i'm not wrong' ) Here is an output from curl -I 

So, is this the expected behaviour? Or am i doing something wrong in order to override that default_ttl for products? 

Thanks in advance

Wednesday 24 September 2014 10:44:16 am

maybe its the call to viewLoaction() which meddles with headers?

Wednesday 24 September 2014 10:50:12 am

Hi 

Gaetano is right. You must use setSharedMaxAge()after the call to original viewLocation():

$response = $this->get( 'ez_content' )->viewLocation( $locationId, $viewType, $layout, $params );
$response->setSharedMaxAge( 86400 * 30 ); 
return $response; 

Wednesday 24 September 2014 10:59:02 am

oh my... :/. makes sense.  easier than i thought 

Thanks both of you. 

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from