Last modified: 2014-07-15 17:36:17 UTC
I'd like to manage the cache expiry with an extension. For example, I'd like to refresh a page every hour. Apparently, for this I should use $parser->getOutput()->updateCacheExpiry( 3600 ); And this works fine but only when $wgDebugToolbar is true; I believe that the problem in the block of this code https://doc.wikimedia.org/mediawiki-core/master/php/html/Article_8php_source.html#l00540 Firstly, the function CacheTime::updateCacheExpiry() does not affect the browser cache. When checking the relevance of the browser cache is compared only date of creating the page (ignored updateCacheExpiry). (line 569) I tried to get around this using $wgOut->enableClientCache(false); And when Article::view: doing uncached parse is sent OutputPage::sendCacheControl: no caching ** But when ParserOutput cache found is sent OutputPage::sendCacheControl: private caching; Mon, 14 Jul 2014 13:42:49 GMT ** instead of 'no caching '. And the problem is repeated again. So there are two errors.
If client did not send If-Modified-Since header it works fine.
Demo http://test.foxway.org/wiki/PhpTags/DateTime_Functions Firefox sends If-Modified-Since and page is have not refreshed. Konqueror not sends If-Modified-Since and page is refreshed every 5 seconds.
CC'ing anomie who has touched the If-Modified-Since code a few days ago for bug 67849
(In reply to Pavel (pastakhov) from comment #0) > Firstly, the function CacheTime::updateCacheExpiry() does not affect the > browser cache. That's because CacheTime::updateCacheExpiry() isn't supposed to be dealing with the browser cache. It's dealing with the lifetime of the CacheTime object in the parser cache. Whether If-Modified-Since should be ignored on a parser cache miss, or if we should store the parser TTL alongside page_touched and have the If-Modified-Since check use the max of page_touched or time() - TTL, is debatable. I'd rather hear from someone who knows more about caching than I do, like Ori or Aaron. > I tried to get around this using $wgOut->enableClientCache(false); > And when Article::view: doing uncached parse is sent > OutputPage::sendCacheControl: no caching ** > But when ParserOutput cache found is sent OutputPage::sendCacheControl: > private caching; Mon, 14 Jul 2014 13:42:49 GMT ** instead of 'no caching '. $wgOut is the OutputPage object. If you're calling $wgOut->enableClientCache(false) as part of the parse, which it sounds like is the case, your code isn't being called when a cached ParserOutput is used so it never gets a chance to affect the OutputPage. This would be expected behavior.
I realized that manage client cache does not make sense here. > Whether If-Modified-Since should be ignored on a parser cache miss, or if we > should store the parser TTL alongside page_touched and have the > If-Modified-Since check use the max of page_touched or time() - TTL, is > debatable. I'd rather hear from someone who knows more about caching than I > do, like Ori or Aaron. I agree. Should I call them hither?
(In reply to Pavel (pastakhov) from comment #5) > I agree. Should I call them hither? I already CCed them, but if you want to reach out to them on IRC or something feel free.