How to use memcached in WordPressTags: cache, memcached, wordpress
What is Memcached?
Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering.
Memcached is simple yet powerful. Its simple design promotes quick deployment, ease of development, and solves many problems facing large data caches. Its API is available for most popular languages.
You can get more information of memecached from this link: https://github.com/memcached/memcached/wiki
Why do you use Memcached?
By using memcached (properly), you limit the number of queries to the database (because they’ll read the results from memcached instead). So after using memcached, you can service more simultaneous users as there are less database query execution, and your website speed will be much faster.
Use Memcached in WordPress
WordPress use Object cache in default, but the object is saved on disk. By using Memcached, the object can be saved in memory, this is much faster than the disk based method. If an object is cached by Memcached, it will be loaded from the memory directly when it need to be used afterwords.
To use Memcached in WordPress, you need to install the related PHP extension. Please be noted that there are two PHP extensions for Memcache: PHP Memcache and PHP Memcached. Right, the only difference is that the latter one has one more letter
d at the end.
You can use
phpinfor() to check which extension is installed on your server.
Now, you need to download the corresponding WordPress Memcached plugins based on your Php memcache extension
PHP Memcache extension：http://wordpress.org/extend/plugins/memcached/
PHP Memcached extension：https://wordpress.org/plugins/memcached-is-your-friend/
Then just copy the
object-cache.php to the folder
wp-content. Be careful, it is
WordPress will check
wp-content folder, it will use
object-cache.php if it is detected under the