This article introduces the difference between memcache and memcached and their installation steps! Hope this helps beginners!
The difference between memcache and memcached
I plan to fully apply memcached technology in my new program. It is easy to understand that memcached is a memory cache, but why is there still memcache?
It’s actually very simple, memcache is an extension of php, used for php to manage memcached, php-memcache.dll.
If memcached is installed but the extension is not installed, then PHP cannot control memcached, but there is no problem in using the command line
If the memcache extension is installed but the memcached service is not installed, then this cannot be used
Only when the memcached service and memcache extension are installed at the same time can you use memcached in PHP to improve dynamic website performance
Steps to install memcached under win7 system 64-bit:
Download memcached-win32-1.4 .4-14.zip, unzip it to disk, for example D:memcached
Run cmd as administrator and go to the folder where memcached is located, for example: cd d:memcached
Install memcached :
d:memcached> memcached.exe -d install
(No prompts on the screen afterwards)
Start memcached:
d:memcached&g t;memcached.exe -d start
(There will be no prompts on the screen afterwards, but if you check "Show all user processes" in "Task Manager", you can see that the memcached.exe process is running)
memcached basic parameter settings:
-p The listening port
-l The IP address of the connection, the default is the local machine
-d start Start the memcached service
-d restart Restart the memcached service
-d stop|shutdown Close the running memcached service
-d install Install memcached service
-d uninstall Uninstall memcached service
-u Run as (only valid when running as root) -m Maximum memory Use, unit MB. Default 64MB
-M Returns an error when memory is exhausted instead of deleting items
-c Maximum number of simultaneous connections, the default is 1024
-f Block size growth factor, the default is 1.25
-n Minimum Allocate space, key+value+flags defaults to 48
-h displays help
When setting parameters, you need to stop memcached first, and then use the command line to set it, such as: d:memcached> memcached.exe -m 1 -d start
d:memcached> memcached.exe -d stop
cached> memcached.exe -d uninstall
memcache.dll: http://pecl.php.net/package/memcache Download and place it in the php/ext extension file. Then modify php.ini and add extension=php_memcache.dll