What is cache?

Overview:

This blog references dev2host server caching, as well as website caching and why it’s good for your website. Before we get into server-side caching, it’s important to understand the basics. Lets discuss 3 types of caching:

1. Browser Caching

When you view this or any other website, your browser caches the content. This means all web browsers (Chrome, FireFox, Edge etc.) are designed to save a copy of each page and file locally on your PC/ Mac or whatever device. The files are saved in the browser in an area called “Cache”. This means that when you visit the same page more than once in the same browser, cached files are served, instead of the browser downloading the files again. This speeds things up dramatically while you browse online.

Why would I want to clear my browser cache and when?

  • Sometimes the browser cache can become corrupt.
  • If you have made programming changes to a website and you are not seeing your updates, you can clear your browser cache to see the changes that were made.
  • Clearing your browser cache will enable you to see a fresh version of your website the next time you visit it.

How to clear the cache in popular browsers:

2. Website Caching Scripts

Most websites hosted on our dev2host servers use either the WordPress or the Magento Commerce platform, so lets discuss how these platforms cache and why they do.

Magento Commerce

Magento is a popular eCommerce system, that by the nature of its code would load incredibly slowly if it did not have a cache mechanism. We will be posting a blog about Magento caching next month.

WordPress

Like Magento Commerce, WordPress is a database driven platform. WordPress plugins and core, use PHP code to query a database and then print the WordPress page to the screen. At the website level its a good idea to use a Cache plugin.

A good WordPress cache plugin will cache the files, CSS and images as well as minify some files to make them load faster. A WordPress cache plugin will definitely speed up your site. We like wp-rocket. It simply works.

3. Server Caching Modules

Server caching is a third level of caching that really speeds things up. There are a few different server cache modules. We use 2 on our servers. We use server modules called:

Dev2host customers should take advantage of the server cache options.

Here is how to do it for WordPress:

(check out Magento blog on how to use memcached and OPCACHE with Magento).

  • Login to your dev2host cPanel and look for the PHP selector under the software tab, select it.
  • Under PHP options make sure memcached and OPCACHE are selected.
  • Look in your WordPress dashboard and select plugins on the left. Find and activate a plugin called “WP-FFPC” (its free) and enable it. There are some basic settings, but generally this works out of the box. (Make sure you have enabled memecached and OPCACHE in your cPanel first).
  • Upon enabling the WordPress “WP-FFPC” you will see a notice at the top of the page saying it is enabled. That’s it!
  • While you are logged into the cPanel PHP Selector you should make sure your website is running the latest PHP version, be sure to check your website functionality and looks after changing PHP versions, note- you can easily change it back. This is a good idea for speed and security.

Memcached:

The Memcached module resides between the Apache LiteSpeed server and the internet. It accelerates delivery of your website to the end user.

OPCACHE:

OPCACHE is a database caching module that is very important for database driven sites like WordPress or Magento. All you have to do is turn it on in cpanel and you are good to go.

Why Should I care About Cache?

To get positioned in the search engines, the faster your site loads the better your site will be positioned. A fast-loading site is very good for SEO.

Your users will be much happier browsing a fast-loading website.

How do I know if my site is loading faster?

Google created a website speed test tool called Page Insights. You can test your URL there and learn how fast your site is loading as well as get advice on how to load it faster, both in the mobile and desktop views. Its a good idea to run benchmark tests with this tool so you can track improvements.

Summary:

Hopefully you understand a bit more about cache functionality now. By utilizing the methods mentioned here we have seen some websites load 30% faster. Its well worth it.

If you are a dev2host customer and need help setting up caching to your advantage open a support ticket and we will be happy to help.

If you are not a dev2host customer, you should be.