Memcached command line usage

Source: Internet
Author: User

Go to the CMD command line and enter Telnet 127.0.0.1 11211 (memcached default port is 11211)

Stats: Use the stats command to view the status of the current memcache Server

Command line display code  
  1. Stat PID 924
  2. Statuptime 21057
  3. Stat time 1303194576
  4. Stat version 1.2.4
  5. Stat pointer_size 32
  6. Stat curr_items 0
  7. Stat total_items 3
  8. Stat bytes 0
  9. Stat curr_connections 1
  10. Stat total_connections 28
  11. Stat connection_structures 8
  12. Stat performance_get 12
  13. Stat performance_set 7
  14. Stat get_hits 3
  15. Stat get_misses 9
  16. Stat evictions 0
  17. Stat bytes_read 772
  18. Stat bytes_written 2514
  19. Stat limit_maxbytes 67108864
  20. Stat threads 1
  21. End

Properties are interpreted as follows: From http://www.51testing.com /? Uid-116228-action-viewspace-itemid-107545

 

PID Memcache server process ID
Uptime Number of seconds that the server has run
Time Current UNIX timestamp of the server
Version Memcache version
Pointer_size CurrentOperating SystemPointer size (32-bit system is generally 32bit)
Rusage_user Cumulative user time of the process
Rusage_system Cumulative system time of processes
Curr_items Number of items currently stored on the server
Total_items Total number of items stored after server startup
Bytes Number of bytes occupied by items stored on the current server
Curr_connections Number of currently opened connections
Total_connections Number of connections that have been opened since the server is started
Connection_structures Number of connections allocated by the server
Pai_get Total get command (get) Requests
Performance_set Total number of SET command (SAVE) Requests
Get_hits Total hits
Get_misses Total number of missed hits
Evictions Number of items deleted to get idle memory (the old items need to be deleted after the space allocated to memcache is full to get the space allocated to the new items)
Bytes_read Total number of read bytes (number of request bytes)
Bytes_written Total number of sent bytes (number of returned bytes)
Limit_maxbytes Memory size (bytes) allocated to memcache)
Threads Current thread count

 

Set, add, replace

<Command name> <key> <flags> <exptime> <bytes> \ r \ n <data block> \ r \ n

Note: \ r \ n is the Enter key in windows.
A) <command name> can be set, add, or replace ".
"Set" indicates that the data is stored according to the corresponding <key>. If not, it is added and some are overwritten.
"Add" means to add the data according to the corresponding <key>, but if the <key> already exists, the Operation will fail.
"Replace" indicates that data is replaced according to the corresponding <key>, but the operation fails if the <key> does not exist.

Sometimes "add" and "replace" cannot be stored.

B) <key> key of the data to be saved on the client.

C) <flags> is a 16-bit unsigned integer (expressed in decimal format ).
This flag is stored together with the data to be stored and returned when the client get data.
The customer can use this flag for special purposes, which is not transparent to the server.

D) <exptime> expiration time.
If the value is 0, the stored data will never expire (but can be replaced by server algorithms such as LRU ).
If it is not 0 (UNIX time or the number of seconds from this time point), after expiration, the server can ensure that the user does not get the data (based on the server time ).

E) <bytes> the number of bytes to be stored. If you want to store NULL data, the value <bytes> can be 0.

F) <data block> the content to be stored. After the input is complete, the client must add "\ r \ n" (in windows, click Enter) as the end mark of the "Command Header.

 

Command Line Code  
  1. Set key 24 10 2
  2. SD
  3. Stored
  4. Replace key 24 10 3
  5. SDD
  6. Stored
  7. Add key1 24 10 4
  8. Sdsd
  9. Stored

 

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.