cache doesn't work with my website

25 zobrazení
Preskočiť na prvú neprečítanú správu

Saada Mehdi

neprečítané,
20. 11. 2022, 12:08:5020. 11. 2022
komu: Chromium-discuss
Hi,
I am positive caching doesn't work on my website (because it's way too slow), and doesn't know why, nor do I even know whether or not a specific ressource is loaded from the cache or the network.

Thanks

Jon Perryman

neprečítané,
20. 11. 2022, 14:16:1620. 11. 2022
komu: 0012...@gmail.com, Chromium-discuss
Learn to use developer tools and work with your web server developer. Developer tools can tell you what is slow and what is happening. It will show you if the request is referencing cache or if it's sending the request to the server. Is the server responding  with HTTP 304 (not modified)?  How long are the requests taking? Does the problem occur in Firefox or Safari (ignore chromium based browsers like MS Ed, Brave or ...). You need to do some basic debugging before anyone can help you. . 

--
--
Chromium Discussion mailing list: chromium...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discu...@chromium.org.

PhistucK

neprečítané,
20. 11. 2022, 18:09:5520. 11. 2022
komu: jon.pe...@gmail.com, 0012...@gmail.com, Chromium-discuss
Looked out of curiosity and your service worker has this -
 event.respondWith(fetch(request).then(saveToCache).catch(serveFromCache));

Seems like it always requests from the network and always saves it in the cache. As far as I know, saving it in caches will not prevent the fetch event or the request - it is on you to load it from the cache within the fetch event.
In other words, caches is not an API for the normal browser cache, it is an API for you to store requests and load them when you want to.

PhistucK

Saada Mehdi

neprečítané,
21. 11. 2022, 4:58:0621. 11. 2022
komu: PhistucK, jon.pe...@gmail.com, Chromium-discuss
but that kind of cache is completely useless, what the hell is this... Is this chromium's fault, or my site ? If my site, then it's actually the hugo static site generator.What should I modify and where, to get it to use the browser's cache if it hasn't expired ?
As far as I understood your lengthy but appreciated explanation, this API `caches` is only called forth when the site can't be reached. Pretty much useless ,so.

PhistucK

neprečítané,
21. 11. 2022, 6:00:2121. 11. 2022
komu: Saada Mehdi, jon.pe...@gmail.com, Chromium-discuss
No, the caches API is not called when the site cannot be reached.
It is simply not an automatic cache mechanism.
It is an author-controlled, rather than browser-controlled caching mechanism. The author (the developer) decides what to cache, when to cache (and can version things, too) and what to load from that cache and when.


This is not a Chromium issue (it should happen in every browser that supports the API), this is what the API is intended to do. If the service worker is entirely generated by that static site generator, it might be a configuration issue, or a bug in the generator.

Not having a service worker at all might cache things normally (have not looked). Otherwise, https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers can explain things.



PhistucK

Jon Perryman

neprečítané,
21. 11. 2022, 11:44:5721. 11. 2022
komu: PhistucK, Saada Mehdi, Chromium-discuss
To simplify this for Saada, this is your site's problem. A service worker is javascript included with your web page. This API is useful if you understand how to use it. Since we don't know your web site's intent, we can't say why you decided to code this statement. If you did not code this statement, then you probably included it from a package you are using on your web  page. 
Odpovedať všetkým
Odpovedať autorovi
Poslať ďalej
0 nových správ