If the browser cache can't return the value, the request goes to the CDN. The CDN, it's a content delivery network, consists of proxy server, servers located globally. The goal of the CDN is to deliver content efficiently. These servers maintain cached resources, allowing users to receive content from the nearest server and reducing network delays. CDN proxy servers also use HTTP caching and respect this crash control and eTag headers. You can set different values for the CDN.
For example, you can use S max age for CDN specific caching duration. You can also specify if it's private content that can only be cached locally. CDN provides another important tool in validation. You can use this in order to issue requests to clear cached content from the CDN proxies, which propagate across the network. Unlike browser cache, when clearing requires user action, CDN validation can be done from a central location.
Well, we almost finished our 10 minutes. Let's see what we can store at each caching point. At the service worker, we can store prefetched API responses for offline use. For example, a list of tasks in a to-do app. For example, we can use default user properties. Just ensure sensitive data is encrypted or protected to mitigate security risk. In the browser cache, you can use it to cache images, fonts, scripts, and other static content. Ensure file name changes when the content changes to prevent stale cache issues. In the CDN, you can cache static resources for a much longer duration and also share data like main categories, main products, article, content, and so on.
To summarize, caching helps improve performance and enable offline functionality. Different caching mechanisms exist along the request journey, and we have tools to control the cache behavior. The key takeaway, take a look on the network tab, see what requests you have and what takes a lot of time, and check which cache you can use to improve performance. Thank you. I hope you find this session interesting. If you have questions or comments, feel free to contact me in LinkedIn or via the conference chat. Have a great day.
Comments