png caching issue, even on tag based loading
jorgeovi opened this issue · 5 comments
Hi, I'm using createjs-2015.11.26.min.js, I have created some games that load maybe 200-300 files and I've noticed this:
- First time I load the game, every file is downloaded from the server, all normal
- I reload the page, and watch Chrome's network inspector. What I expect is that every file is loaded from the disk cache in 5 or 10 miliseconds, but what actually happens is that image files are not totally cached, every file has a 25 - 50 B request on the "Size" column, instead of the expected "(from disk cache)". This takes 50-60 ms each, and is ruining my total preloading time.
- This happens only with images, mp3, fonts etc are properly re-used from file or memory cache
I have tried both XHR and tag-based but the result is the same. Images are not totally downloaded, but also they are not totally cached.
Is it the same if you just load a few of the images? Say 5-10 instead of 200-300.
I just stripped down the library to a handful of images and yes, it's the same.
This looks like a server issue, either you have must-revalidate set, or a very short expiration on the cache. This causes the browser to check the server to see if there have been any changes to the resource. Because there hasn't been, the server simply returns a 304 Not Modified response (which is the 25B you're seeing), and the browser uses the cache.
See here for a fairly robust description of how caching works:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching
Feel free to reopen if this is not the case.
gskinner you nailed it, I checked and turned out that both our servers had must-revalidate on. Sorry for raising a non-issue.
on a side note, gskinner, I've been developing flash and then h5 applications since the late 90's and I can't slip this opportunity to say thank you, during this years I've used your libraries and learnt from your articles countless times :)
Happy I could help! Thank you for the kind words, it's always wonderful to know you've had an impact.