1 / 15

The Most Frequently Used Caching Headers

The caching behavior of any Web content is dictated by its caching policy, which is articulated through certain HTTP (Hypertext Transfer Protocol) headers. Expires, Etag, Last-Modified, Cache-Control, Content-Length and Vary are some of the most commonly used caching headers.

htshosting
Download Presentation

The Most Frequently Used Caching Headers

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The Most Frequently Used Caching Headers

  2. Table of Contents • Websites and Web Hosting • Caching and Web Caching • Advantages of Web Caching • Readiness of Content for Caching • Caching Headers • Expires • Etag • Cache-Control • Last-Modified • Vary • Content-Length

  3. Websites and Web Hosting • We visit numerous websites daily for various purposes but not many of us know how these are made accessible over the Internet. So, let us delve into that first. • A website consists of a collection of related web pages and content that exists under a single domain name. Websites are made up of files that are stored on the servers of web hosting service providers and delivered from there as per users’ requests. These web hosting companies make websites accessible by providing the services and the technologies that are needed for this purpose. Web hosting can be of many types, such as shared, dedicated, reseller, cloud, WordPress, VPS etc. • Usually the best web hosts in the field of hosting are referred to as the “Best Windows Hosting Company” or as the “Linux Dedicated Hosting” or as the “Top Cloud Hosting Company” depending on the type or types of hosting services that these excel in providing.

  4. Caching and Web Caching • Caching When copies of files are stored in a temporary storage location (cache), this is known as caching. This makes it faster to access files. A web browser caches a website’s images, HTML files and JavaScript, which helps to load a website more speedily. • Web Caching Web caching entails storing temporarily Web documents (Web pages and various other types of Web multimedia). This serves to decrease server lag. A web cache system can be a computer program or an appliance. It stores copies of documents that pass through it. The cache fulfils subsequent requests when certain conditions are met and ensures that the origin server doesn’t get overloaded.

  5. Advantages of Web Caching There are numerous benefits of web caching. These are mentioned below in no particular order. • Enhanced page delivery speed • Better responsiveness • Reduction in the workload of backend server • Protection against total outages (cached content can be delivered when servers are down) • Availability of content regardless of network interruptions • Better performance of the same hardware • Reduction in network costs

  6. 1-800-123 -8156 Whoa! That’s a big number, aren’t you proud?

  7. Readiness of Content for Caching Despite it being possible for every type of content to be cached, not every content should be cached. Based on its readiness for caching, web content can be classified into three categories. These are mentioned below. • Cache-friendly Content- This type of content doesn’t change frequently and is capable of being cached for longer periods of time. Its examples are style sheets, media content, icons, logos, images and JavaScript libraries. • Moderately Cache-friendly Content- Such content changes regularly. It includes HTML pages, JS and CSS that get modified frequently and all those content requests that need authentication cookies. • Content that shouldn’t be Cached- Due to security concerns certain types of contents should not be cached at all. This category of content includes highly sensitive and confidential content as well as content which is specific to users.

  8. Caching Headers • The caching policy that is set by the owner of a particular content dictates its caching behavior. Specific HTTP (Hypertext Transfer Protocol) headers are used for the purpose of articulating these caching policies. The most frequently used caching headers for cache policy specification are mentioned in the next few slides.

  9. Expires • The “Expires” header is used to set a time in the future for a specific content with regard to its expiration. When that time arrives and the content expires, any requests for that content will be sent to the origin server. This header is limited in its scope and should be used as a fallback option.

  10. Etag • The “Etag” header is made use of with cache validation. A unique Etag for an item can be provided by the origin at the time of serving the content initially. A cache can send a content’s Etag when there is a requirement to validate the content. The origin will either inform the cache regarding the content being the same or it will send the updated content along with the new Etag.

  11. Cache-Control • “Cache-Control” is a modern replacement for the “Expires” header that implements a design that is more flexible. It is well supported; hence, preferable to Expires. This header helps to set various cache policy instructions. Multiple instructions are separated by commas in it. • Some of the “Cache-Control” options that can be used to specify the caching policy for content are, no-cache, public, private, no-store, max-age, s-maxage, no-transform, proxy-revalidate, must-revalidate.

  12. Last-Modified • The “Last-Modified” header specifies the last time that a specific item had been modified. This can be employed as part of the validation strategy for ensuring fresh content.

  13. Vary • The “Vary” header is used to communicate to caches that there is a need to pay attention to another header when deciding if a request is for the same item. The requested host as well as the path to the resource are used by a cache as the key that aids in storing a cache item. The Vary header is usually used to communicate to caches to key using the Accept-Encoding header. This helps the cache to differentiate between uncompressed and compressed content.

  14. Content-Length • Despite it not being specifically involved in caching, it is important to set the “Content-Length” header while defining caching policies. That is due to the fact that certain software won’t cache content unless they are aware of the size of the content, in advance, for which they will require to reserve space.

  15. Thanks! ANY QUESTIONS? www.htshosting.org

More Related