Member-only story
Optimizing Cache Policies for Improved PageSpeed Insights in Rails Apps

PageSpeed Insights suggests setting a cache lifetime of at least a year for assets to enhance the browsing experience of repeat visitors. A longer cache duration, can help your app avoid the need for repeat visitors to reload all assets upon each visit, resulting in faster page load.
How to check your current site’s cache policy
You can check if your site has assets with an inefficient cache policy by using PageSpeed Insights. When you run the analysis, PageSpeed Insights will identify any assets with a short or non-existing cache settings.
When I inspected my own site, it revealed that I had no Cache TTL set for my assets. This means that whenever a returning visitor accesses my site, they will be required to load all the assets again, affecting the page load time.

You can also easily observe the cache policy for each asset on your site by accessing the Chrome DevTools and navigating to the Network tab. For detailed instructions on how to locate the cache policy, you can click here.