Skip to content
This repository has been archived by the owner on Dec 31, 2022. It is now read-only.

LABjs reads from cache when f5 #106

Closed
lessfish opened this issue Jul 30, 2015 · 4 comments
Closed

LABjs reads from cache when f5 #106

lessfish opened this issue Jul 30, 2015 · 4 comments

Comments

@lessfish
Copy link

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
20150730164443

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.

@getify
Copy link
Owner

getify commented Jul 30, 2015

Perhaps try the CacheBust option in LABjs?

$LAB.setOptions({ CacheBust: true }).script(..)

@lessfish
Copy link
Author

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?

@getify
Copy link
Owner

getify commented Jul 31, 2015

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.

@lessfish
Copy link
Author

lessfish commented Aug 3, 2015

thanks very much for your detailed answer!

@lessfish lessfish closed this as completed Aug 3, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants