-
Notifications
You must be signed in to change notification settings - Fork 473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mtime based cache id problems #28
Comments
Agreed, Minify_HTML_Helper::getRawUri should take into account more than the max mtime. Since this is likely to run on every HTML page, it should probably not be more advanced than |
anyway, i added testsuite for this : i tried to link that branch to this issue (without creating pull request with another issue), but failed |
how about just adding count() of files in group to existing mtime value? chances it will get the old value with just adding new file to group are really small (you need then to have all group members mtime be decreased by amount of files being added to group and that's just not that realistic than just having all files in group with same mtime) unfortunately $this->_filePaths is empty in groups mode, need to dig more how to get access to files in groups |
To get the mtimes you need the filepaths so we may as well use it (it will involve some refactoring). If we don't someone will complain that they swapped out one file for another and it didn't change... |
i wonder, is the original mtime calculation still needed? as i see two paths:
rename Minify_HTML_Helper::getLastModified and do the same in just one iteration over group members for both remains question, perhaps should instead mathematically sum the _filePathChecksum with _lastModified instead of string concat, so the urls won't grow too long? or that would cause weird side effects... in fact i have patch ready for 1. already |
correction: if we rename ->lastmodified to something new (combination of lastmod+filepath) then the result won't be that long, just one number. additionally need to run it over crc32 and do sprintf %u over it (to avoid 32/64 bit differences) |
here's implementation for 1) - https://gist.github.com/2851198 |
ping |
On 6/1/12 7:01 AM, Elan Ruusamäe wrote:
Please fork and submit this as a pull request. Steve |
i have forked already, linked to this issue as well, just wanted to know opinion which way to make next commit. but fine. i'll commit the 1) and you can merge: https://github.com/glensc/minify/tree/issue-28 do you really need pull request to merge from there? as that would create another issue in your repository |
Sorry, your branch is fine. I'll look at this ASAP and probably will merge as is. |
Okay, the checksum of file paths, is working okay, but there's still problem when i replace oldest file with even more older file, i think that here should additionally just sum mtimes together and take just last 4 bytes (to allow 32bit systems overflow and get same result as 64bit systems) |
rewrite it once again, pls review whole branch diff |
did you have time to review? |
i think cacheId should be changed as well. otherwise client is told to fetch new content, with new url, however minify internally will still serve old content because for it nothing changed. currently it tried to understand how internal cacheId works, but i found it doesn't even use files or for it at all. i.e Minify::_getCacheId() has:
and Minify_Source::getDigest has:
am i looking something wrong? or this Minify_Source::getDigest shouldn't look mtime/content/path at all currently? |
I did not want tons of old cache files piling up requiring a cleaning process, so cacheId regards everything EXCEPT timestamps. That way, if the user is just altering files, the Minify cache files are reused. You're right that this means the cache is not properly invalidated if MAX(timestamps) doesn't increase. It requires the user to touch() at least one source file in that case. I think the only real fix for this is to move to a system like this. |
Closing in favor of #41 |
currently if using groupsConfig, then cache id becames simply max(mtime) of all files.
so, the cache id will remain the same, if i add more files to the group having identical timestamp.
i guess there should be added * NUMBER_OF_FILES to avoid this problem
so i had in my groupsConfig.php:
then url built with was:
later i added one more file:
and the url remained the same:
as the files have identical timestamp:
expanding that timestamp:
The text was updated successfully, but these errors were encountered: