Rate this article :
5/5 | 1 opinion
This article was useful to you ?
Yes
No
Vous avez noté 0 étoile(s)
Sommaire
Procédure
Memcached is a service for storing objects in memory. This service enables you to store and then retrieve "objects" such as binary data or MySQL query results very quickly. Its main advantage (but also its main drawback) is that all the data is stored in RAM memory: access is therefore very fast, but it is volatile (all the data will be deleted as soon as the service is restarted).
Although the Fastest Cache module supplied and pre-activated on our cPanel web hosting packages already gives you a high-performance page caching system, you may also need to optimise dynamic pages such as search pages, shopping basket pages, news feeds, an instant messaging system, a comments list or a member area.
Unfortunately, these highly dynamic pages cannot be cached in their entirety because their content changes very frequently. If the data is retrieved instantaneously from the database (PostgreSQL or MySQL), you run the risk of both saturating your database server and experiencing mediocre performance.
To remedy this, you can, for example, store the names of the most popular products and their prices in an object cache system. This way, when the shopping basket page loads, you won't have to execute an SQL query to retrieve the most popular products. Your site will be faster and your MySQL or PostgreSQL database will be under less strain.
There are two different PHP extensions that can be used to enable a PHP script to communicate with a Memcached server: memcache and memcached. It is important to check with the author of your script to find out which of the two is used by your site. To activate one of them :
1. Connect to your cPanel interface and click on"Select a PHP version" in the"Software" section.
2. Tick"memcache" or"memcached" as required.
That's it. You can now connect to the memcached servers from your PHP scripts. An instance of memcached is available by default on your cPanel account. Here are the connection details:
WordPress already has an object cache ecosystem that allows plugins and themes to ask WordPress to store the result of a complex MySQL query in memory. This works with the WP_Object_Cache class. By using memcached as a storage space for WP_Object_Cache, WordPress can take advantage of memcached's performance.
The"Memcached Object Cache" WordPress plugin allows you to do this with the memcache PHP extension, which should be activated beforehand (see previous paragraph). To install it, download the plugin's object-cache.php file and place it in your website's wp-content folder ( using FTP or the cPanel file manager):
Next, you will need to fill in a cache key so that your website knows which data on memcached is its own. This is done by adding the line"WP_CACHE_KEY_SALT" to wp-config.php:
And that's it.
1. Connect to your Wordpress interface and click on"Extension/Add" to install W3 Total Cache.
2. Search for the"W3 Total Cache" plugin and click on"Install maintenance".
3. Click on"Activate".
4. Look for the plugin in the list of plugins and click on"Settings" below it.
5. Go to the"Database caching" section, tick the"Enable" box and enter"memcached" in the"Database cache method" section. Finally, click on"Save setting and purge cache" to save your request.
You can perform the same operation for the"Object cache" section. The Object cache allows you to cache only the results of database objects.
1. Connect to your Prestashop dashboard, click on "Advanced settings" and then on"Performance".
2. Go to"Cache", click on "Yes" then choose"memcache" or"Memcached" depending on the extension you activated when selecting your PHP version. Finally, click on"Save" to save the request.
You are now able to configure Memcached on your cPanel hosting package for WordPress or Prestashop. However, it should be noted that all data on Memcached is accessible to all users on the same cPanel server as yours. For this reason, it is imperative that you never store sensitive information on Memcached.
Don't hesitate to share your comments and questions.
Rate this article :
5/5 | 1 opinion
This article was useful to you ?
Yes
No
1mn reading
How do I configure Cloudflare on a website hosted on cPanel?
4mn reading
Using Redis as a persistent object cache for WordPress on cPanel
4mn reading
Speed up your site with Fastest Cache - Cache Varnish
3mn reading
How can I use IpXchange to customise the IP of your domain?