Caching

Caching refers to the temporary storage of data with the goal of processing future requests more quickly, effectively improving page speed. A second advantage of caching is reduced server load. Saving parts of a website’s content means that the server does not need to process new requests for the same information every time someone visits a page.
 
There are 4 clearly defined ways of caching:
 

Browser Caching

The user’s browser is responsible for saving resources like images, CSS, and JavaScript. So, instead of requesting the same information from the server during a future visit, the user’s browser will supply the resources. As a result, browser caching improves page speed and decreases data transfer. Exactly how long those resources are stored in a browser is defined by HTTP headers.
 

Server-Side Caching

In server-side caching, the web server is responsible for saving generated pages or data. This way, the server can respond to requests more quickly. There are three kinds of server-side caching:

  • Page Caching: saves entire HTML-pages to prevent dynamic pages from having to be rebuilt every time a request comes in.
  • Object Caching: saves certain data, like results from a database query, to prevent having to connect to the database for each request.
  • Opcode Caching: saves precompiled PHP-scripts to improve processing speed.

 

CDN Caching

A Content Deliver Network (CDN) saves copies of web pages on various servers located closer to the user. Because these servers are physically closer to the users, the saved content will reach them faster, and load on the original server decreases. Some well-known examples of CDN are Cloudflare, Akamai, and AWS CloudFront.
 

Proxy Caching

In proxy caching, a proxy server will temporarily save data in order to efficiently handle client-requests. This way, proxy caching effectively decreases the load on the original server and improves page speed.
 
The proxy server can act as an intermediary for the client and original web server by saving copies of regularly accessed content, such as HTML-pages, images, and API-keys.