This section is tossing the next Memcached, some harvest, record a bit.
1. What is Memcached
Memcached is a caching technique that allows you to put your data into memory to speed up through memory access, because the fastest memory, the main purpose of memcached technology, accelerates.
a large hashtable table is maintained in MEMACHEC, the table is in memory, and the structure of the table is key value.
Installation of 2.Memcached
This article is only installed on the Windows system (my is the WIN10 system). Memcached before the 1.4.5 version memcached can be installed as a service, and in the 1.4.5 and after the release of the feature is removed, the two types of installation is not quite the same, two different methods see here http://www.runoob.com/ Memcached/window-install-memcached.html. The version I chose is the 64-bit version of 1.4.4.
① unzip the downloaded installation package into the C:\memcached directory.
② installation, I divided it into two categories, the difference is whether you can close the Startup window.
1) The first way is to double-click or run Memcached.exe as administrator. This method is started by default, the port number is 11211, there are two ways to verify the successful start: in cmd with telnet 127.0.0.1 11211 Connection Connection Success indicates a successful boot, with Netstat-an to see 11211 ports in the listening, This also indicates a successful start.
We can also start at the cmd command line (preferably run as Administrator): Memcached.exe–p port number, which can switch port number.
However, these two startup methods cannot close the windows that start memcached, and once closed, the service is not available.
2) run cmd command as Administrator!!! (very important), then go to directory C:\memcached, execute command memcached.exe–d install.
After running the command, you will see that memcached has been installed as a service, and we can either start the service or use the command memcached. EXE -d start. After the boot is complete, this time off the Startup Window service can continue to use.
3) When you want to open multiple memcached on a computer to do the cluster, the first way is to use the command memcached.exe–p port number, but so the console window can not be closed, bad.
The second way is to regenerate into a service, command:SC create memcached2 binpath= "c:\memcached\memcached.exe-d runservice-m 128-c 512-p 11 212 "start= Demand displayname=" Memcached2 " , If you want to modify the parameters you can change in the registration table, run Regedit.exe,
Hkey_local_machine\system\currentcontrolset\services\memcached2
Basic use of 3.M emcached
The use of M emcached is themost basic is the curd operation, usually just start with the command to operate, followed by the program code operation.
Open the cmd command (preferably run as Administrator) and perform telnet 127.0.0.1 11211.
① Increase:
Basic syntax add key name 0 storage time (seconds) data size (characters)
Example: Add key 0 Hello
② query:
Basic syntax Get key name
Example: Get key
③ Modification:
Set basic syntax set key name 0 storage time Data size
Example: Set key 0 40 5
Set, if key exists, it is equivalent to adding new, if present, there is quite a replacement
Set basic syntax replace key name 0 storage time Data size
Example: Set key 0 40 5
Replace, if key does not exist, it fails, and this directive requires that key must exist.
④ Delete:
Basic syntax Delete key name
Example: Delete key
⑥flush_all can erase the data uniformly.
⑦stats, this looks at the status of Memcached.
Calculate the hit rate cmd_hits/cmd_get. The higher the better, through this, you can also know whether the cache set is reasonable.
Write it here first, and then add it later.
Installation and use of memcached