Serve Static Assets with an Efficient Cache Policy
Lighthouse Report Audit: Serve Static Assets with an Efficient Cache Policy
A Lighthouse report will identify all the assets that are not currently set up to be cached along with the TTL (Time-to-Live) duration and an estimate of the data saved for each file if it were cached. Only assets that are identified as cacheable assets will be flagged. A cacheable asset is anything that meets all the following requirements:
- It is an image, font, media file, script, or style sheet.
- An HTTP response of 200 (OK), 203 (Non-Authoritative Information), or 206 (Partial Content) was received.
- There is not an explicit no-cache policy set.
Depending on your server framework, there are different methods to set caching policies. Review your framework documentation for exact steps on how to set your cache control headers. Additionally, CMS frameworks like WordPress can provide you with plugins that will assist you with setting cache policies automatically for your site. And remember, a long cache policy is not always best. It depends on the specific needs of the business and the type of asset.
Lighthouse is an open-source tool that is used to run an audit against your web pages and provides scores and suggestions for improving page performance, accessibility, SEO, and more.
PageSpeed Insights is a tool created by Google that reports on the performance of a page on both mobile and desktop devices, and provides suggestions on how that page may be improved.