gaurav-spacreo / minify

Automatically exported from code.google.com/p/minify
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Remain cache if set of file changes #191

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Minify version: 2.1.3
PHP version: 5.3

What steps will reproduce the problem?
1. make 3 JS files with alert(i);
2. send them to browser by Minify 
($files=array('file1.js','file2.js','file3.js'))
3. check page
4. update php script to send ($files=array('file1.js'))
5. check page

Expected output:
on p.5 expected output is 1

Actual output: actual output is from p.3

The problem is if you need to send to user different sets of files (e.g. change 
functionality), but actual files are not changed, the Minify sends "304 Not 
Modified" and browser uses it's cache.

Original issue reported on code.google.com by rcma...@gmail.com on 19 Sep 2010 at 12:56

GoogleCodeExporter commented 9 years ago
What's the URL you're using to call Minify and are you using custom code in 
groupsConfig.php?

Original comment by mrclay....@gmail.com on 19 Sep 2010 at 4:45

GoogleCodeExporter commented 9 years ago
I call Minify inside PHP:
Minify::serve('Files', $options = array( 'files'=>array('file1.js','file2.js') 
));

Original comment by rcma...@gmail.com on 19 Sep 2010 at 7:00

GoogleCodeExporter commented 9 years ago
...and cached in Memcache

Original comment by rcma...@gmail.com on 19 Sep 2010 at 7:01

GoogleCodeExporter commented 9 years ago
I got it. It's not defect of Minify. I looked in Minify::serve and found out, 
that all files are packed in one cache. So even if Minify checks the set of 
files, it will rebuilt it's cache for that set.
In attached file you can find my solution.
I hope the option of separate cache will be built-in in future versions. :)

Original comment by rcma...@gmail.com on 19 Sep 2010 at 9:29

Attachments:

GoogleCodeExporter commented 9 years ago
I see, you're optimizing based on knowing your common files will be the same 
for each user. This would be a bit cleaner use of the API: 
http://pastebin.com/A06vw1Wh

Particularly, letting Minify serve the content directly should improve 
performance because it caches the output of gzip, whereas Apache has to re-zip 
every request.

Original comment by mrclay....@gmail.com on 20 Sep 2010 at 12:47