Today, I occasionally touch the memcached cache technology, although the temporary study of technology is not very deep, but the overall feeling is very useful, because as one of the large-scale portal site speed-up technology is used very frequently.
To be blunt, memcached is maintaining a large hash table in memory.
Hashtable: keyVavle
Stored data types are generally available (except for resource types)
The following first installs the memcached:
Download good memcached software, the software is not big:
Put the installation software in your own designated folder;
Then cmd input installation instructions: memcached.exe-d-install. Complete the installation of the memcached.
After installation is complete, start: memcached.exe-d start.
Verify startup service: Netstat-an; If there are 11211 ports, the description succeeds.
The above port is the listening port of the memcached.
Connecting memcached services: Telnet 127.0.0.1 11211
The basic syntax:
Add key 0 Time size
Content
Get method: Get key.
LAN shared connection can also be implemented: lelnet IP address 11211
Implement data modification: Set key 0 Time size------then what to modify
The above modification is equivalent to adding data if Key1 does not exist, otherwise it is equivalent to modifying the data. However, if you do not exist in the way of replace, you will be prompted to fail.
There is the deletion of the use: Delete key: You can achieve the direct deletion of data.
APPEND: Data append.
Flush_all: Erase All data
The above test on the installation process of memcached and basic crud operations, and PHP has not been used, this is the basis, but also the premise of learning.
From the example I wrote above, I can tell that memcached is used to store data in memory, mainly to speed up, because in the memory of the data compared to other complex operation is very fast.
However, one drawback is that when we close the memcached service, the data in the memory table will not be saved and result in data loss, so it is not very important to suggest to save with memcached, and
Use very frequent data.
Preliminary understanding of Memcache technology and basic CRUD operations