LABjs reads from cache when f5
lessfish opened this issue · 4 comments
my code is quite easy that contains only one line “$LAB.script('index.js')”
I use my wampserver to have a test, when I press f5, i intend to load data from the server, but the fact is as below
it seems it reads data from the cache, when I change the cold, it does not present the right data. but I have pressed f5, I do not know how to get what I really want, or it is a problem of wampserver? or labjs? please help me, with full thanks.
Perhaps try the CacheBust
option in LABjs?
$LAB.setOptions({ CacheBust: true }).script(..)
Thanks very much for answering. I have learned CacheBust option, by adding this every time it will load the materials from the server ignoring cache, but I wonder if I can do this as usual, I mean when I press f5, it will return HTTP 304 if not modified and HTTP200 when modified, can I? I also wonder it's an issue of wampserver or labjs?
LABjs doesn't do any loading or logic around caching. It simply causes a <script src>
tag to request a specific URL. The browser and the server (by way of its response headers -- caching, etc) are entirely in control of how and when those files will be loaded, reloaded, or pulled from cache.
The CacheBust
option only prevents caching by making sure the URL is always different, which effectively defeats any caching that may otherwise have happened. But it doesn't have any direct control over the loading itself.
thanks very much for your detailed answer!