contao / news-bundle

[READ-ONLY] Contao News Bundle
GNU Lesser General Public License v3.0
9 stars 14 forks source link

Tag news and news archive in 4.6 #40

Closed Toflar closed 6 years ago

Toflar commented 6 years ago

Here's the page example. Should be added on bothtl_news and tl_news_archive, imho.

// Tag the response
if (System::getContainer()->has('fos_http_cache.http.symfony_response_tagger'))
{
    /** @var ResponseTagger $responseTagger */
    $responseTagger = System::getContainer()->get('fos_http_cache.http.symfony_response_tagger');
    $responseTagger->addTags(array('contao.db.tl_page.' . $objPage->id));
}
leofeyer commented 6 years ago

Where exactly?

Toflar commented 6 years ago

https://github.com/contao/news-bundle/blob/master/src/Resources/contao/modules/ModuleNews.php#L78 maybe? wdyt?

leofeyer commented 6 years ago

I'm not quite sure what you want to accomplish. 😄

Toflar commented 6 years ago

Tag any news so that you can cache the website forever in the reverse proxy and when you edit the news, this cache entry is invalidated.

leofeyer commented 6 years ago

But news can have several pages – one reader page and multiple list/archive pages. If a news item is changes, we would have to invalidate all of them, wouldn't we?

Toflar commented 6 years ago

Yes. That's why we have tags.

leofeyer commented 6 years ago

See #42.