WordPress Super Cache plugin, use browser cache. How to set up wordpress caching? Hyper Cache settings to reduce server load
Recently, one of our readers asked us how to clear the WordPress cache? Your web browser, server, and plugins installed on your site may use a caching process that is unlikely to allow you to see the updated status of your blog.
In this article, we will show you how to properly clear the cache of your WordPress blog.
Caching solutions store a static version of your site. This allows WordPress to skip the heaviest PHP scripts and improve the performance of your site.
WordPress There are many types of caching solutions. The most popular are the "And" type cache plugins.
These plugins provide an easy-to-use interface for managing blog cache, cached content expiration, and on-demand caching.
WordPress hosting managed by providers like WPEngine uses their own caching solutions so you don't need to install this caching plugin.
If you are using a CDN service such as "MaxCDN" or "CloudFlare" it will also serve cached copies of static content.
If you use a web application firewall as "Or" to increase the security of WordPress, they also have their own cache to speed up your site and reduce downtime.
Finally, your browser may also store cached versions of pages on your computer.
The purpose of caching is to speed up your site and improve the overall user experience. However, sometimes it prevents you from seeing the changes you make to your site, which can be frustrating. In this case, you will need to clear your cache to see your changes.
However, let's see how to clear the cache in WordPress.
Step 1: Clear your browser cache
First, you need to clear your cache. Most web browsers can store static content such as style sheets, JavaScript, and images from a website to speed up subsequent visits.
However, sometimes web browsers may not realize that a web page has changed. Instead of getting a fresh copy, they can still reload the page from the cached version on your machine.
This is how you clear the cache of your Google Chrome browser. First you have to click on the menu icon and then select« Additional Tools > Clear Navigation Data .
A window will open where you can select the content you want to remove. Make sure the cached images and files are verified, and then click the " Clear browsing data P".
You have successfully cleared your browser cache and can now try to access your website.
If you still don't see any changes, continue with the next steps.
If you want to choose between the two best WordPress cache management plugins, check out our article:
For other web browsers, please refer to the respective documentation on how to wipe their caches.
Step 2: Clear the WordPress Plugin Cache
If you are using a WordPress caching plugin, you must clear your plugin's cache. Most caching plugins allow you to easily do this from the appropriate settings.
Clear cache from WP Super Cache
This allows users to instantly cache their site in one click. Its robot automatically selects your WordPress pages for cache generation and then automatically activates the recommended WordPress caching options such as GZIP compression, page caching, and cache preloading.
WP Rocket also includes additional features that you can enable to further improve your productivity. Including lazy loading of images, CDN support, DNS prefetching, minification, etc.
2.WP Fastest Cache
WP Fastest Cache is a WordPress cache plugin that offers just about everything a user might be looking for. The developers of this plugin claim that it is the simplest and fastest WP Cache system. And to be honest, it is! With over 300,000 active installs, this plugin offers visitors a fast browsing experience.
Caching data in WordPress allows you to speed up your site and significantly reduce the load on your server. There are three main types of caching in the kernel - page caching, object caching, and transitive caching. In this article, we will briefly cover all three types, as well as take a look at some of the popular WordPress caching plugins.
What is a cache?
A cache is an intermediate buffer that allows you to store the most frequently used data in memory or on a hard disk, which can significantly speed up the process of issuing them. Good examples where it is beneficial to use caching are:
Each of these queries can be accelerated using caching. For example, if we display our latest message from Twitter on the home page of the site, we don't have to make a request to Twitter every time we visit the home page.
It is enough to make one request on the first visit and save the result for a certain time in the cache, and on the next visit to the main page, we can return the saved result from memory much faster.
Caching in WordPress
There are three main types of caching in WordPress:
- Page caching - allows you to save entire pages in the cache, and issue them from the cache on subsequent requests
- Object caching - allows you to cache data of an arbitrary type
- Transit caching - very similar to object caching, allows you to save data for a certain period of time
All three types of caching overlap or depend on each other under certain circumstances. We will talk about each type in more detail, starting with the simplest and most common.
Page caching in WordPress
It takes a lot of work to get a single WordPress archive page out. It's a few database queries to get the latest posts, widget settings, theme settings, active plugins, site title and description, background image, title, and much, much more.
Page caching (page cache) allows you to save the result of issuing the entire page. On a subsequent request to the same address, the same page is issued, but from the cache, respectively, much faster and with less load on the server.
When the content of a post or page changes, the page cache is reset, and the next request caches a new page with updated data.
Page caching is not implemented in the very core of WordPress, but there are all the necessary functions to implement this at the plugin level. The two most popular page caching plugins are WP Super Cache and W3 Total Cache, although there are others.
WP Super Cache Plugin
WP Super Cache is the most popular page caching plugin for WordPress. It allows you to create and serve static HTML files for your pages, and with a certain configuration, you can set up the issuance of these pages directly by your web server (Apache or nginx), bypassing the processing of PHP files in general.
New versions of the WP Super Cache plugin have some additional features, such as CDN setup, support for the mobile version of the site, and so on, but the essence of this plugin is page caching.
WP Super Cache is suitable for both beginners and more experienced WordPress users, but since it uses the file system for caching, it will be extremely difficult to use for a site with two or more web servers.
The W3 Total Cache plugin is younger than WP Super Cache, but not inferior to it in terms of functionality. It is gaining popularity very quickly, and today has over 2 million downloads from the WordPress.org directory.
W3 Total Cache allows you to store cached pages both on the hard disk and in memory. It does not preserve the cache structure, as WP Super Cache does, so it is impossible to customize the output without using PHP, but unlike WP Super Cache, using external storage makes it easy to work in a multi-server architecture.
W3 Total Cache has a huge amount of customization and additional functionality, including CDN support, database query caching, script and style compression, and much more. We recommend W3 Total Cache for more advanced WordPress users.
At the time of writing this article, the Batcache plugin has only been downloaded about ten thousand times from the WordPress.org directory, but in this case this is not an indicator of its effectiveness. In terms of performance, it is not inferior to either WP Super Cache or W3 Total Cache.
The Batcache plugin has only one function - page caching, but it does it flawlessly. Batcache uses external object caching to store data, making it easy to use in a multi-server architecture. This plugin is used by the massive WordPress.com network, with over 40 million sites, over 2000 servers and over 10 billion page views every month.
Which page caching plugin you choose depends on the size of your site, your capabilities, and your experience with WordPress. If you are not currently using page caching plugins, we always recommend starting with WP Super Cache. If more features and finer caching are important to you, try W3 Total Cache. If you are well versed in programming and server administration, and are ready to sacrifice a graphical interface when setting up, try Batcache.
Object Caching in WordPress
Object caching (object cache) is implemented in the very core of WordPress. This mechanism allows you to store objects of an arbitrary type in memory and is mainly useful for WordPress theme and plugin developers.
For example, when requesting an option from a MySQL database using the get_option function, WordPress will store the result of this function in memory, and the next time it is accessed, it will return the result from memory without making queries to the database.
Similar caching is implemented in the core for many objects, including: options, posts (pages, and custom types), post metadata, terms, and taxonomies. That is why WordPress developers should not be afraid to use functions like get_option and get_post , as such calls do not cause unnecessary requests to the database.
Object caching in WordPress is done using a number of internal functions, including: wp_cache_add , wp_cache_set , wp_cache_get .
Persistent object caching
It is important to know that WordPress object caching is not persistent by default. This means that the cached values are valid for only one page request, and on subsequent requests, the cache is generated from scratch.
At first glance, this is not at all beneficial, but if you count how many times WordPress calls the get_option function to process a single request (about 500 times), then the benefit of object caching becomes obvious.
However, persistent object caching (or external cached) in WordPress is easily implemented using third party plugins like Memcached Object Cache or APC Object Cache . Both plugins allow you to use the server RAM to store WordPress objects, while the objects do not disappear when the request ends. This approach significantly reduces the load on the MySQL database.
It is also worth noting that when page caching is enabled, most often time does not reach working with saved objects, since the page is completely issued from the cache. This is not a reason to disable object caching, especially when dealing with logged in users, and some plugins (eg Batcache) generally use object caching to store pages.
Transit caching in WordPress
For users, this caching method is completely transparent. Transient caching (transient cache) allows developers to save data for a certain period of time. This method is implemented in WordPress with the get_transient , set_transient , and delete_transient functions.
Transit caching is most often used for fragment storage, especially when it comes to requests to external resources, such as to display a message from the Twitter network or to display the weather forecast from a third-party service.
Similar caching is also used in the core when working with RSS feeds, and requests to update themes, plugins and WordPress core.
Unlike object caching, transitive caching is persistent by default in WordPress, and stores all data in the database. But it's important to note that when using an external object caching plugin (like Memcached or APC), transitive caching will use that plugin for data storage.
Object caching or transitive caching?
Choosing between the two methods is fairly easy for developers. If we need to save the result for a certain period of time and for more than one request, it is best to use transitive caching. If we need to store a small object in memory only for the current request, object caching is suitable for us. If you need to save something for an indefinite period of time, the easiest way is to use the options - then there is a guarantee that the value will get into the database.
When using the plugin for persistent object caching, all three methods will use this plugin.
Conclusion
Caching plays an important role in improving the performance and speed of sites, as well as optimizing them for high loads. In most cases, for sites with low traffic, this is not so important, although it is always nice when the site opens faster.
For most sites, simple page caching solves all issues with speed and load. This is the first thing to do when problems arise, especially on cheap hosting sites. Page caching plugins are easy to install and configure.
Object caching and transitive caching are fairly transparent to WordPress users, but it's important for developers to be well aware of and separate the two mechanisms. Plugins for external object caching often require more effort to set up than page caching.
Finally, remember that caching is just one of the ways to increase the speed of your site. If speed is important to you, don't forget about image optimization, script and style compression, query and database optimization, use of CDN servers, and load balancing.
If you have any questions about caching in WordPress or problems setting up any caching plugin, leave a comment and we will be happy to help you.
02.07.2013 05.11.2013
Co-founder of WP Magazine and the first WordCamp conference in Russia. A developer at Automattic, he is actively involved in the development of the WordPress core. Favorite programming language: Python.
Hello dear blog readers In this article we will touch on the important topic of speeding up your blog on the WordPress platform and reducing the load on the hosting server using hyper cache.
is a wordpress caching plugin (wordpress cache). Be sure to use the wordpress cache and the loading speed of your site will increase significantly.
When you increase the number of visitors to your blog, a problem arises. When a reader wants to view a particular page on your site, they must wait for the server to generate it according to its wordpress theme and content.
How many times a certain page will be requested, so many times it will be created on the server again and again. The more visitors come to the blog, the greater the load on the server and the longer the load time.
All this can be avoided by applying the so-called caching or wordpress cache. What it is?
This is the process of saving the generated page at your request in a specific directory on the site using the Hyper cache plugin. Now, if someone else accesses the same page on the server, it will not be regenerated, but simply taken from the desired folder where it is stored wordpress cache and sent to the user's browser.
Thus, caching blog web pages is a very effective way to reduce the load on the hosting server and speed up the entire blog.
Hyper cache plugin. Installing and configuring wordpress cache.
It's very good that wordpress cache only works for unregistered users of your blog. In most cases, site owners do not allow visitors to register on their resource, and it turns out that the only person registered on the blog is the administrator, that is, you.
This means that for you personally wordpress cache won't work and that's great. Imagine that you made some changes on your blog (for example, in design), then it turns out that you will not see these changes until you reset the wordpress cache, and this would have to be done all the time.
Download caching plugin You can from the official wordpress site.
- Unzip the archive with the plugin and drop the Hyper cache folder into the wp-content/plugins/ plugins folder on your server using an FTP client
- Go to your blog console Plugins-Add New-Upload-Install
Enable wordpress cache.
To do this, open the wp-config.php configuration file for editing, which is located in the root directory of your blog and paste the following line of code there:
define('WP_CACHE', true);
This can also be done using the Filezila file manager.
Pasting can be done anywhere in the wp-config.php configuration file, somewhere closer to the end, but before the line:
/** Absolute path to the WordPress directory. */
if (!defined('ABSPATH'))
or, if in English:
/** WordPress absolute path to the WordPress directory. */
if (!defined('ABSPATH'))
define('ABSPATH', dirname(__FILE__) . '/');
Now we return to the Plugins blog console, find the Hyper cache caching plugin and activate it.
In order for the Hyper cache plugin to create a folder for the wordpress cache on the blog, you need to set permissions to 777 on the wp-content or wp-content/plugins/hyper cache/ folder. Read this about setting permissions.
Then the wp-content or wp-content/plugins/ hyper cache folders can be reset to 755 permissions, and the new wp-content/plugins/ hyper cache/cache folder can be set to 777, and then the Hyper cache plugin can write to or erase all HTML files from wordpress cache.
Configuring the correct operation of the Hyper cache plugin.
Let's go to the Hyper cache settings immediately after activating its work by clicking Options
Or the same thing will happen if you go to the blog console Settings - Hyper cache
In the Configuration area, the main part of the settings for the Hyper cache plugin will be made. First of all, check the box next to the Activate cache? And save the settings Save.
That's it, the wordpress cache is enabled, you can see further how many pages are cached in total.
Opposite the field Lifetime of cached pages you need to set the number in minutes, during this time an HTML copy of your web pages will be stored and any user will receive it from there during this time.
It doesn't make sense to keep the number low since most of the pages on your blog are not updated and are archived. It costs me 7200 minutes (5 days) This is how the well-known techie E. Popov advises.
You just need to see if the disk space on the server allows you to store a lot of cached pages. And it depends on the hosting plan that you bought for your blog and the number of visitors, or rather the number of pages that readers would like to see.
Basically, the disk space is at least 2-5 GB, so 7200 minutes will be just right.
The next field "Auto-cleanup every" is also intended for optimal use of disk space on the hard drive on the server. That is, every 1440 minutes (this corresponds to 1 day in my settings), notes whose lifetime has expired are deleted from the cache folder.
So unnecessary and useless files are deleted at the frequency that you set.
Using the field How to clear the cache you can specify how to clean up when updating an old material or when creating a new one:
- All- corresponds to updating the whole wordpress cache
- None- wordpress cache does not change
- Single page (Single page strikly) - the cache is updated only for the note in which changes have occurred
You can fill in this field as I have (see above) or choose it yourself.
In field gzip compression you can check the box, and then the wordpress cache files will be saved and sent in a compressed form, which will reduce the load on the server and increase the speed of the blog.
If there is a checkmark in the box Do not cache the home (Do not cache the home page), the home page will not undergo the caching process.
This may be necessary in case of frequent home page updates, when the very creation of the wordpress cache makes no sense, since the cache is often updated and then it does not matter where the page is being generated - from the cache or in the usual way.
If you do not want to cache any part of the blog, you can in the field exclude URI enter a part of the address (for example, blog categories /kartinki-foto-smeshno) and then pages containing this part of the URL will not be cached.
The rest of the settings can be left as is. Don't forget to click the Save button.
Next to the Save button is another very important Clear Cache button. You will need it when you redesign your blog and want blog visitors to see the updates as well. Otherwise, they will always be served only the old cached version of all pages.
The main work is done, you need to check if caching works on the blog using the Hyper cache plugin. To do this, follow these steps:
Access your blog using a different browser. It turns out that you are logged in as a regular visitor, not an administrator
Press the Ctrl-U buttons. You will see the source code of the page
Go to the very bottom of the source code. You should see something like the line