Memcached Study notes (1)

Source: Internet
Author: User
Tags delete key memcached

Memcached Technology

Introduced:
Memcached is a caching technique that allows you to put your data into memory, which speeds up through memory access, because the main purpose of the memcached technology is faster,
A large hashtable table is maintained in Memachec, which is in memory, and the structure of the table is
Key value
String (string, numeric, Array, object, Boolean, binary data, NULL)

Principle Explanation:

 Install and use memcached
Installation steps
(1) Download memcached software
(2) Installation
Go to cmd and switch to the directory where Memcached.exe files are located
Memcached.exe–d Install
(3) Start memcached
First, you can go to the service click Start
The second type, the command line
Memcached.exe–m 200mb–d start "starts in Deamon, default 64M"

If you start a win7 startup, you can use the following methods
Memcached.exe–p Port number

Start method do not close the console.

The range of port numbers: 0-65535, because the port number is represented by two bytes
Known port: 0-1024 already used in the program, Apache, MySQL 3306, ftp, SSH 22
oracle:1521, stmp:25

Use Netstat–an if you see Port 11211 on the monitor, start OK
NETSTAT–ANB is what program listens to, this instruction also can see which user connects to our server.

If not installed properly, the reason may
1. If you are Win7, Win7 is high on security, all must be installed as Adminstartor identity.
You switch into adminstrator, go to install, in the boot
2. Your Memcached.exe directory has Chinese, or special characters, to ensure that the directory does not have Chinese and special characters.

(4) Prepare to study the curd operation of the memcached.
See how Telnet operates (curd) log on to Telnet connection to memcached service
Telnet 127.0.0.1 11211

If you can't use Telnet because the system does not exist Telnet.exe, you can copy Telnet.exe to another machine c:\windows\system32
2. Increase
The basic syntax is:
Add key Name 0 storage time (seconds) data size (character)
Example:
Add Key1 0 30 5 How to get
The basic syntax is:
Get key value
Get Key1 Modification

The set key name 0 holds the time data size.

Example:
Set Key1 0 40 5
☞ If the key1 does not exist, it is equivalent to adding new and, if it exists, quite a replacement

Replace key name store time data size
Replace Key1 0 40 5
☞ If the key1 does not exist, it fails, and this instruction requires that the key must exist. Delete
The basic syntax is
Delete key Name
Like what
Delete Key1
Append append data to existing key append key 0 60 15

Prepend prepend data to existing key prepend key 0 60 15

The

Flush_all can be unified to empty the data.

Here you can calculate the hit rate cmd_hits/cmd_get. The higher the better.

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.