Last modified: 2014-07-15 17:36:17 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T69997, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 67997 - CacheTime::updateCacheExpiry() only affects parser cache, not varnish or browser cache
CacheTime::updateCacheExpiry() only affects parser cache, not varnish or brow...
Status: NEW
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.24rc
All All
: Low normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-07-14 17:43 UTC by Pavel (pastakhov)
Modified: 2014-07-15 17:36 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Pavel (pastakhov) 2014-07-14 17:43:21 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.
Comment 1 Pavel (pastakhov) 2014-07-14 17:48:08 UTC
If client did not send If-Modified-Since header it works fine.
Comment 2 Pavel (pastakhov) 2014-07-14 18:00:23 UTC
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.
Comment 3 Andre Klapper 2014-07-14 19:15:34 UTC
CC'ing anomie who has touched the If-Modified-Since code a few days ago for bug 67849
Comment 4 Brad Jorsch 2014-07-14 20:23:44 UTC
(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.
Comment 5 Pavel (pastakhov) 2014-07-15 03:22:13 UTC
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?
Comment 6 Brad Jorsch 2014-07-15 17:34:32 UTC
(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.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links