Memcache is an in-memory key-value pairs data store. The data store lives in the memory of the machine. That is why it is much faster compared to other data stores. The only thing that you can put in memcache are key-value pairs. You can also put anything that is serializable into memcache either as a key or a value. In general, there are two major use cases such as Caching and Sharing Data Cross App Instances. In caching, datastore query results are kept or a user authentication token and session data. There are also APIs call that can also be cached. URL fetching can also be kept in memcache. Content of a whole page can also be kept in memcache.
Results can be ten times much faster as explained by this benchmark test carried out by Google Developers team some times back.
1.For installation on a wordpress website, thats simple straight forward. On CLI, simply do a
yum install memcached
2. By default, memcache configurations on Centos7 is found at /etc/sysconfig/memcached as follows
[[email protected] ~]# cat /etc/sysconfig/memcached PORT="11211" USER="memcached" MAXCONN="1024" CACHESIZE="64" OPTIONS=" "
3. To check if your memcache is running correctly, use the following command
echo stats | nc localhost 11211
4. Now, login to the plugin area and download the WP-FFPC plugin and activate it.
5. In the wp-config file of the wordpress CMS, define the following parameters
6. Save changes in the WP-FFPC plugins settings. On your server, you can now see the caching being done
[[email protected]]# echo stats | nc localhost 11211 | grep total_items STAT total_items 32
And, here you are. A simple and fast memcache implementation on your WordPress website.
Note: By activating a wordpress plugin, you should make sure that proper auditing have been carried out as these days there are several vulnerabilities present on WordPress plugins.