Is updating a linked file meant to cache like that....?

Is updating a linked file meant to cache like that....?

Howard Miller發表於
Number of replies: 3
Core developers的相片 Documentation writers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片
Familiar scenarion...

* Upload a file and link a resource to it.
* Change the file... upload a new one of the same name

The old file is cached and it's anybody's guess when the users see the new version. I've done some poking about and it does look like Moodle is responsible (not 100%). It seems to do this regardless of cache settings. I'm surprised this hasn't been addressed.

Am I just missing something or is this one of those impossible to fix things??
評比平均分數: -
In reply to Howard Miller

Re: Is updating a linked file meant to cache like that....?

Helen Foster發表於
Core developers的相片 Documentation writers的相片 Moodle HQ的相片 Particularly helpful Moodlers的相片 Plugin developers的相片 Testers的相片 Translators的相片
Hi Howard,

I found the following config setting mentioned in the discussion overwriting resource files:

// Seconds for files to remain in caches. Decrease this if you are worried
// about students being served outdated versions of uploaded files.
// $CFG->filelifetime = 86400;

If you find it helpful, perhaps you could add the information to Resources FAQ. wink
評比平均分數:Useful (1)
In reply to Helen Foster

Re: Is updating a linked file meant to cache like that....?

Howard Miller發表於
Core developers的相片 Documentation writers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片
Ahh... ok. The upshot is that file.php generates a "cache-control" header. The default is a whole day, so it's perhaps not surprising that this can cause some confusion. Setting it to 0 should turn the thing off. If that's a good idea is another matter entirely.

I'll add something to those docs.

Thanks Helen - again 大笑
In reply to Howard Miller

Re: Is updating a linked file meant to cache like that....?

sam marshall發表於
Core developers的相片 Peer reviewers的相片 Plugin developers的相片
This is really beneficial for performance if your pages load a lot of things through file.php (images etc), so it might be better not to turn it off entirely. (Actually, Moodle should probably make an effort at sending these headers for more types of file...)

You might want to reduce it but keep it within the range of a typical user session; for example 1 hour (3600).

--sam