When I used to understand memcache, I felt very confused about what server, What client, and what I was confused about. Today I did some research to thoroughly understand the differences between memcache and memcached.
First, let's talk about the installation method in windows:
This method is widely used on the Internet and is also very simple,
Before installation, I need to focus on some important points. I am entangled for a long time due to these problems.
First, make sure that the memcache extensions you want to download are consistent in your php version.
Http://museum.php.net/php5/ can find the pecl package corresponding to your php version on this web site, which has the corresponding php_memcache.dll File
If this is not found, search in google. If it is not, download the source code package online and use vc6 to compile the package. Note that it is best to use vc6, otherwise problems may occur. Of course, another method is to change to another version of php.
I am prompted that the specified module cannot be found when I restart apache after configuration because the version does not match.
Now let's talk about my environment. I am using php5.3.5.
Fortunately, the corresponding php_memcache.dll file is not found in the above address.
So I found a 5.3 on the Internet for a while, and the result was very lucky.
Let's talk about the next step.
Write
1. Download the stable version of memcache for windows and decompress it to a disk, for example, in c: \ memcached
2. Enter 'C: \ memcached \ memcached.exe-d install' on the terminal (that is, the cmd command interface) to install
3. Enter 'C: \ memcached \ memcached.exe-d start' to start.
NOTE: in the future, memcached will be used as a windows Service and will be automatically started every time it is started. In this way, the server has been installed.
4. Download php_memcache.dll. Find the corresponding php version file by yourself.
5. Add a line 'extension = php_memcache.dll 'to php. ini'
6. Restart Apache and check phpinfo. If memcache exists, the installation is successful!
I copied this step online, but the step is correct,
Let's talk about the difference between memcached and memcache.
The Internet says this is a c/s structure software. Yes indeed
If it is a c/s structure, it indicates that there must be a server and a client.
Therefore, the server end is memcached, and the client end can be considered as php_memcache.dll.
Php_memcache.dll provides a set of functions for caching, extracting, and deleting caches. Through these functions, the data is stored on the machine where the memcached service is installed, it can be a local machine or a machine on other networks.
In this test, you can only enable some functions in php_memcache.dll, operate on the cache, and disable the memcached service to see if it can be used normally. At this time, it cannot be used.
Therefore, we can regard memcached as the server php_memcached as the client.
In this way, you will understand
Finally, we recommend a small tool named memadmin, which is a powerful tool for viewing the memcached server. It is written in php + jquery and will be placed at the end of this blog, if you are interested, you can download it.
Linux has not been configured yet. I will try it later and summarize the problems.
Appendix: Some memcached commands
Memcache command write
-P listening port
-L connected IP address. The default value is local
-D start: start the memcached service.
-D restart: restart the memcached service.
-D stop | shutdown the running memcached Service
-D install the memcached Service
-D uninstall memcached Service
-U runs as the identity (only valid when running as root)
-MB maximum memory usage, in MB. The default value is 64 MB.
-An error is returned when M memory is used up, instead of deleting items.
-C: Maximum number of simultaneous connections. The default value is 1024.
-F block size growth factor, default value: 1.25
-N: minimum allocation space. The default value of key + value + flags is 48.
-H Show Help
Attachment: http://up.2cto.com/2011/1124/20111124050347851.rar
Author: NightWish