CreateJS / PreloadJS

PreloadJS makes preloading assets & getting aggregate progress events easier in JavaScript. It uses XHR2 when available, and falls back to tag-based loading when not.
http://createjs.com/
MIT License
2.88k stars 764 forks source link

png caching issue, even on tag based loading #262

Closed jorgeovi closed 5 years ago

jorgeovi commented 5 years ago

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:

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.

nocached

owendwyer commented 5 years ago

Is it the same if you just load a few of the images? Say 5-10 instead of 200-300.

jorgeovi commented 5 years ago

I just stripped down the library to a handful of images and yes, it's the same.

gskinner commented 5 years ago

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.

jorgeovi commented 5 years ago

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 :)

gskinner commented 5 years ago

Happy I could help! Thank you for the kind words, it's always wonderful to know you've had an impact.