Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

WordPress enables Memcached memory caching to improve the speed of websites

2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you WordPress to enable Memcached memory cache to improve the speed of the website, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Memcached memory cache can optimize many functions of WordPress and make your WordPress faster. The following WordPress tutorial column shows you how to use Memcached to deeply optimize WordPress.

Many people ask me how WordPress is fast, the general simple answer is to install Memcached, this is really not perfunctory, it is no exaggeration, installed Memcached can make WordPress several times faster, but really use WordPress, or need to have a deeper understanding of WordPress, so I reorganize all my blog articles on Memcached, do a special in-depth optimization WordPress collection, so that you really understand WordPress optimization.

What is Memcached?

Memcached is a high-performance distributed memory object caching system. Using Memcached in dynamic programs can not only improve the speed of access, but also reduce the load of the database.

Memcached can store any type of data (strings, objects) generated from the calling database and API, or page rendering into memory, or it can be read directly into memory. Its API supports most of the current popular programming languages, Memcached's official website: http://memcached.org/

At first, Danga Interactive developed Memcached to improve the speed of LiveJournal.com. At present, it has provided 1 million users with as many as 20 million page visits a day, which is accomplished by a cluster of Web servers and database servers.

PHP extension of Memcached

PHP has two Memcached extensions: "PHP Memcache extension" and "PHP Memcached extension", which is where we got mixed up.

The PHP Memcache extension is implemented in PHP and supports both object-oriented and process-oriented interfaces. It has been implemented since 2004. It is an old extension with few functions and fewer properties.

The PHP Memcached extension is developed based on libmemcached and uses the API provided by the libmemcached library to interact with Memcached services. It only supports object-oriented interfaces and was only implemented in 2009. Memcached extensions are more complete and support more functions, such as batch operations. Now it is generally recommended to use Memcached extensions.

The following is a comparison list of supported features:

Memcached can greatly improve the efficiency of WordPress.

Because WordPress supports Object Cache by default, to implement Memcached in WordPress is to use Memcached to write the Object Cache of WordPress into memory and read it directly from memory the next time you access it. Memcached has a great speed advantage over reading data directly from a database, or saving data from Object Cache to a file and then reading it from a hard disk.

The above figure shows the hit rate of cached objects after I love Fish Filets in Hot Chili Oil after using Memcached. You can see that the hit rate is very high, close to 99%, which basically ensures that all data is fetched from energy memory, so using Memcached for caching is very effective.

How WordPress enables Memcached caching

First of all, it needs to be clear that both the Memcached server and its PHP extension must be installed.

If the Memcached server is installed and no extension is installed, then PHP cannot manipulate the Memcached. Similarly, if the PHP Memcached extension is installed, but the Memcached server is not installed, then this cannot be used.

1. First of all, the server needs to install Memcached server, and then PHP needs to install Memcached extension, again notice that PHP has two extensions: PHP Memcache extension and PHP Memcached extension, the difference between the two is only one letter D, you can use the phpinfo () this PHP function to see which extension is installed, be sure to use the PHP Memcached extension.

2. The WPJAM Basic plug-in has integrated the function of Memcached. Copy the object-cache.php file in the wpjam-basic/template/ directory to the wp-content directory. Note that it is not wp-content/plugins/.

3. WordPress automatically checks whether there is an object-cache.php file in the wp-content directory, and if so, call it directly as the WordPress object caching mechanism.

4. After the installation is successful, WPJAM Basic automatically sees the information of Memcached under system Information under the WordPress > WPJAM menu:

The WPJAM Basic plug-in has integrated Memcached. After downloading WPJAM Basic, copy the object-cache.php file in the wpjam-basic/template/ directory to the wp-content directory.

These are all the contents of WordPress's method of enabling Memcached memory cache to improve the speed of the website. Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 275

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report