Preliminary understanding of Memcache technology and basic CRUD operations

Source: Internet
Author: User
Tags delete key

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.