4

I'm designing a project which has the same structure as a blog with Symfony2.

My home displays articles and have a sidebar where there are links to login, or links to our account if we are logged.

My sidebar is an ESI, my question: If I set a validation cache on my homepage (depending on the updated date of my last article), does the sidebar will display its content independently of this cache ? Otherwise, is there another solution to do this ? (Setting articles list as an ESI, but is that ESI can have a validation cache ?).

Thank you for your answers

Sybio
  • 8,565
  • 3
  • 44
  • 53
  • 1
    Have you already found the answer to this question? I'm not sure if I'm getting you right, but if you want to cache your homepage, but not your sidebar, yes that's possible with ESI. Just set setSharedMaxAge in the homepage action and do not set it in the sidebar action. – Michael Sauter Feb 03 '12 at 12:35
  • I'am having issues with ESI on pages that has a "Last-Modified" header cache strategy. Please take a look at this discussion on the Symfony2 google group: https://groups.google.com/forum/?fromgroups=#!topic/symfony2/V4BItzpLbOs – Gregoire Aug 29 '12 at 13:32

1 Answers1

1

Yes, it is possible to have parts of page cached independently. It can be implemented by setting different headers to $response:

$response->setPublic();
//or
$response->setPrivate();
//or 
$response->setSharedMaxAge(600);

The detailed answer for your question can be found at this Symfony2 documentation page.

Vitalii Zurian
  • 17,858
  • 4
  • 64
  • 81