Data storage (assume key is test, value is 12345) printf "settest005 \ r \ n12345 \ r \ n" | nc127.0.0.112000STORED data retrieval (assuming key is test) pri
Data storage (assuming the key is test and the value is 12345)
Printf "set test 0 0 5 \ r \ n12345 \ r \ n" | nc 127.0.0.1 12000
STORED
Data Retrieval (assuming the key is test)
Printf "get test \ r \ n" | nc 127.0.0.1 12000
VALUE test 0 5
12345
END
Increase the value by 1 (assuming that the key is test and the value is a positive integer)
Printf "incr test 1 \ r \ n" | nc 127.0.0.1 12000
12346
Reduce the number by 3 (assume that the key is test and the value is a positive integer)
Printf "decr test 3 \ r \ n" | nc 127.0.0.1 12000
12343
Delete data (assuming the key is test)
Printf "delete test \ r \ n" | nc 127.0.0.1 12000
DELETED
View Memcached status
Printf "stats \ r \ n" | nc 127.0.0.1 12000
STAT pid 3025
Statuptime 4120500
STAT time 1228021767
STAT version 1.2.6
STAT pointer_size 32
STAT rusage_user 433.463103
STAT rusage_system 1224.515845
STAT curr_items 1132460
STAT total_items 8980260
STAT bytes 1895325386
STAT curr_connections 252
Stattotal_connections 547850
STAT connection_structures 1189
STAT performance_get 13619685
STAT performance_set 8980260
STAT get_hits 6851607
STAT get_misses 6768078
STAT evictions 0
STAT bytes_read 160396238246
STAT bytes_written 260080686529
STAT limit_maxbytes 2147483648
STAT threads 1
END
Simulate the top command to view the Memcached status:
Watch "printf 'stats \ r \ n' | nc 127.0.0.1 12000"
Or
Watch "echo stats | nc 127.0.0.1 12000"