Deep Dive into HTTP Caching: cache-control, no-cache, no-store, max-age, ETag and etc.

  Рет қаралды 33,654

Software Developer Diaries

Software Developer Diaries

Күн бұрын

Пікірлер
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries 2 жыл бұрын
Forgot to mention the "s-maxage" directive: it also indicates how long the response is going to be fresh, but it's only specific to public caches.
@shivanshagarwal12
@shivanshagarwal12 Жыл бұрын
went through a lot of content none could explain as easily as you did, thanks for the great video :)
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries Жыл бұрын
Happy to hear that! :)
@WebdevBlizz
@WebdevBlizz Ай бұрын
But his explanations are not always correct, don't 100% rely on it.
@spots2012
@spots2012 Жыл бұрын
The key nuance about must validate, is that an http response consists of both headers and body. With a validate request, the client still needs to make a request to the server, but the server can respond with headers only saying 'yup nothing changed ' and so the body does not need to be streamed.
@joachimzayana1744
@joachimzayana1744 7 ай бұрын
Please continue making video! Explanation are clear, introduced at the right pace, looking forward watching the others
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries 7 ай бұрын
Thanks, will do!
@imtiazux
@imtiazux 7 ай бұрын
Thank you so much. Everything are now clear like water. 👌
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries 7 ай бұрын
Most welcome 😊
@kondziorf
@kondziorf 2 ай бұрын
The no-cache explanation is wrong in the video. From the MDN: "The no-cache request directive asks caches to validate the response with the origin server before reuse." So it takes from cache when server says that it is ok to.
@quannguyenhong6300
@quannguyenhong6300 Жыл бұрын
Thanks for the clear and concise video !
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries Жыл бұрын
Sure thing!
@akashagarwal6390
@akashagarwal6390 Жыл бұрын
awesome video, really liked the in-depth details, no bullshit.
@shaheenns3113
@shaheenns3113 2 жыл бұрын
The no-cache response directive indicates that the response can be stored in caches, but the response must be validated with the origin server before each reuse, even when the cache is disconnected from the origin server. It goes to the server only for validaiton right ?
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries 2 жыл бұрын
Exactly, only for validation to possibly avoid downloading the file.
@sahukaridharani728
@sahukaridharani728 2 жыл бұрын
No store means?
@sKopheK
@sKopheK Жыл бұрын
exactly my point, but came here to get to know more about it 😂
@mahdibeldjoudi3269
@mahdibeldjoudi3269 Жыл бұрын
This video is underrated
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries Жыл бұрын
Thanks mate 😎
@nithathghm4347
@nithathghm4347 Жыл бұрын
Thanks! Really nice way to explain concepts 🙂
@slickchick8292
@slickchick8292 Жыл бұрын
This was so very helpful, thank you very much!
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries Жыл бұрын
You're very welcome!
@tech3425
@tech3425 10 ай бұрын
Great vid. Still confused between must-revalidate and stale-while-revalidate
@optimeshtic
@optimeshtic 5 ай бұрын
Great explanation! I have a question though. What will be the proper setup for a WP site where u use a plugin to control browser, page & object cache + use a cdn at the same time (also if the cdn act as reverse proxy like cloudflare)?. It's pretty confusing for me, who handles what?
@fellainthewagon7166
@fellainthewagon7166 2 жыл бұрын
today i god this question on interview but no answered. Now I know a bit more about caching via http header, thanks!
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries 2 жыл бұрын
Oh I see! Good luck with the interviews!
@PiyushGhosh-l4k
@PiyushGhosh-l4k 5 ай бұрын
What's diff b/w reverse proxy and cdn here in this case ??
@rimagerhard5047
@rimagerhard5047 Жыл бұрын
Thanks! Very nicely explained.
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries Жыл бұрын
Thanks, Rima!
@aamiramin6112
@aamiramin6112 Жыл бұрын
So Informative. Thanks for sharing
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries Жыл бұрын
You’re welcome ;)
@Teleschmiede
@Teleschmiede 2 жыл бұрын
Happy hello from Berlin-Spandau.
@panzerdp
@panzerdp Жыл бұрын
A big THANK YOU!
@Pranavk-tc5sc
@Pranavk-tc5sc Жыл бұрын
thanks for the content✌
@bevedel
@bevedel 13 күн бұрын
awesome. thank you
@abirsheikh5300
@abirsheikh5300 Жыл бұрын
How do my browser know which server of CDN to request?
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries Жыл бұрын
Via a DNS lookup, which will eventually lead to the closest CDN geographically. Also keep in mind that the data is cached separately for every CDN server at every location, it's not magically distributed across all servers.
@abirsheikh5300
@abirsheikh5300 Жыл бұрын
​@@SoftwareDeveloperDiaries thanks a lot 😊
@ihorbilobran4690
@ihorbilobran4690 2 жыл бұрын
Thank you, man!
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries 2 жыл бұрын
Thanks for watching, buddy!
@ihorbilobran4690
@ihorbilobran4690 2 жыл бұрын
@@SoftwareDeveloperDiaries Great and simple explanation. Before I found your video, I was reading HTTP caching MDN docs (and I understood nothing from that)
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries 2 жыл бұрын
@@ihorbilobran4690 those look very well structured but still hard to understand, you're right :D
@mohamadal3k513
@mohamadal3k513 3 ай бұрын
There is something wrong with your statement about the no-cache directive. You said something incorrectly. The no-cache directive's cache status can be HIT, but it will not always be MISS. When a request reaches the cache, it first checks with the server using an ETag to determine if the file is still valid and has not been modified. If the file is valid, the cache will send it to the client, and the status will be "HIT." If the file has been updated, the cache will retrieve the new version from the server, and the status will be "MISS."
@gabriel_bricage
@gabriel_bricage Жыл бұрын
Hey, Great video! I am learning how to create websites with html css and js. I don't know anything about php. To use no-store how can I write it in my code? Thanks
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries Жыл бұрын
Hey mate, I don't know much about PHP unfortunately. Are you using any framework?
@gabriel_bricage
@gabriel_bricage Жыл бұрын
@@SoftwareDeveloperDiaries no I use HTML, CSS and a bit of JS. I build from scratch. But I found the solution for my question so it’s good! Thanks man 💪🏼
@wilfredomartel7781
@wilfredomartel7781 Ай бұрын
Good work! I have past nearly 3 days trying to clear cache from http sites in chrome browser. Now we have https and https still remain in browsers :(
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries Ай бұрын
Hmmm :/
@MajesticaYEH
@MajesticaYEH Жыл бұрын
Awesome!
@gerogoya332
@gerogoya332 2 жыл бұрын
Great content! I'm doing automation and have to check (by API) if an image has changed after selecting and saving a new one. I store the image etag before updating the image and then I check if the etag is the same. Is etag reliable for the purpose? Thank you so much, I'm new suscriber.
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries 2 жыл бұрын
Thanks mate! Interesting question. Since ETags are primarily about network caching, I would rather go for a more reliable way in case if you're using a database, meaning storing some kind of an image ID in the database that you can distinquish it by. If not, ETag should be enough, since a new one is created for each new resource.
@Sriram156
@Sriram156 Жыл бұрын
Would be nice if you add the nginx configs for the various items discussed in the video. :)
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries Жыл бұрын
Will keep that in mind for future videos! :)
@laurassalias630
@laurassalias630 2 жыл бұрын
Nice!
@arknitosh
@arknitosh 2 жыл бұрын
Very Informative video. Thanks! But can you please help me with the HTML code or .htaccess code? Also, How do I set the cache for 15 minutes?
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries 2 жыл бұрын
Happy to help :) To set the cache for 15 minutes you can use max-age=900. developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#response_directives
@WebdevBlizz
@WebdevBlizz Ай бұрын
Unfortunately there are many mistakes in your video. It is false that you should never store HTML files in the cache. Most onlineshops do this e.g. Magento 2 with Redis.But you should use no-cache. This directive instructs browsers to validate the cached HTML with the server before using it, ensuring that users receive the latest version while still benefiting from caching. The term no-cache in the context of HTTP caching is a bit misleading. It does not mean "do not cache at all". Instead, it means the browser must validate the cached content with the server before using it. no-cache basically means "don't use cached content without server validation." "It's always going to emit the cache and it's going to always miss." This is incorrect. With no-cache: The file is stored in the cache. On subsequent requests, the browser checks with the server whether the cached version is still valid. If valid, the server responds with 304 Not Modified, and the cached version is used.
@TuvRaz
@TuvRaz 10 ай бұрын
I am more confused new than I was before
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries 10 ай бұрын
Oh no 😅
@mohammedeleriaan5986
@mohammedeleriaan5986 8 күн бұрын
Your Style is amazing, Simple & Professional. Keep Going. Subscribe+=1;
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries 7 күн бұрын
Thanks for the sub mate! 🙂
Deep Dive into REST API Design and Implementation Best Practices
12:02
Software Developer Diaries
Рет қаралды 70 М.
How does Caching on the Backend work? (System Design Fundamentals)
22:45
Software Developer Diaries
Рет қаралды 47 М.
Каха и дочка
00:28
К-Media
Рет қаралды 3,4 МЛН
Enceinte et en Bazard: Les Chroniques du Nettoyage ! 🚽✨
00:21
Two More French
Рет қаралды 42 МЛН
Everything you need to know about HTTP Caching
13:33
the roadmap
Рет қаралды 162 М.
[Frontend System Design] - Deep dive into HTTP [Part 1]
23:37
Front-End Engineer
Рет қаралды 11 М.
Speed Up Your Apps with Cache Control
14:42
Huntabyte
Рет қаралды 20 М.
HTTP 1 Vs HTTP 2 Vs HTTP 3!
7:37
ByteByteGo
Рет қаралды 363 М.
HTTP Caching with E-Tags -  (Explained by Example)
16:47
Hussein Nasser
Рет қаралды 57 М.
The Four Levels of Caching in Next.js
25:48
Ankita Kulkarni
Рет қаралды 6 М.
Caching Pitfalls Every Developer Should Know
6:41
ByteByteGo
Рет қаралды 132 М.
Harry Roberts - Cache Rules Everything
39:01
London Web Standards
Рет қаралды 1,2 М.
Каха и дочка
00:28
К-Media
Рет қаралды 3,4 МЛН