What is caching?
In computing, caching data improves performance and user experience by temporarily storing previously requested data in a cache for faster retrieval upon later requests. For example, when you load a web page, the web browser stores some of the web page’s files in the browser cache on your computer. The next time you visit the page, the page loads faster since some of the required files are already stored on your hard disk. After clearing the browser cache, the next time you visit a web page, the server must respond with all the page’s files and assets during the next page request.
While there are different types of hardware and software caches across the IT industry, references to the process of caching on the web generally refer to various methods of caching website content to reduce network traffic and shorten web page load times.
Because cache storage space is usually limited, cached data is only stored temporarily. Each cached item must include an expiration time indicating when it should be refreshed with a new copy of the file. For instance, browsers store cached files until their Time to Live (TTL) expires or the cache meets its maximum size.
What is web caching?
Private and shared caching work together to reduce network latency and traffic. Different types of shared caching, like proxy servers, help the web servers they sit in front of, caching frequently used resources for many users. As in the above example, a web browser cache is one example of private, or client-side, caching that helps shorten page load times.
What is CDN caching?
A Content Delivery Network (CDN) uses a widely distributed network of proxy servers to cache website content in such a way that the data is physically closer to the end-user. Since requests for web pages travel a shorter distance, responses are faster, resulting in faster web page loading times.
What is DNS caching?
Each time you enter a domain name, the Domain Name System (DNS) must perform a DNS lookup to find the domain’s IP address. Since querying nameservers for each lookup takes time, domain records are also cached for a faster response upon the next request.
What is a WordPress cache?
When WordPress caches content
Since WordPress lacks a built-in solution for caching dynamic page content, many third party options are available to help set up page caching in addition to simple object cache (WP default), such as:
- Plugins like W3 Total Cache and NitroPack
- Caching tools like Varnish
- WordPress-optimized hosting platforms often include integrated caching capabilities.
When does a WordPress cache refresh?
If a web page changes, its cached content must also be refreshed. Most websites don’t need to refresh the cache very often. Once the cache reaches its maximum size, the oldest cached files are automatically deleted to make room for more frequently requested pages.
Resetting the cache manually
Sometimes it’s necessary to reset the cache manually. Particularly for site-wide updates and changes. If a website’s content receives an update or changes in any way, the cached version of each page may need to be manually refreshed. Older versions of cached pages are deleted, and each new page request results in a fresh cache file that reflects the new changes. Although some conditions can require a manual cache reset, a good caching solution will trigger an automatic cache refresh after any changes to the website.
Cached file expiration
In order to use limited cache storage efficiently, older versions of cached content must be periodically deleted. Caches are configured to determine how long different types of content should remain cached before they’re deleted. Static resources like images don’t change often, so their maximum age can typically be longer. Other content that updates frequently might have a shorter expiration time so the cached content is refreshed more often.