先用命令来安装,提示找不到该命令,因为没有安装homebrew,类似于centos里的yum
homebrew安装
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
memcached 安装
brew install memcached
开启memcached
memcached -d -p 11211 -u nobody -c 1024 -m 64
连接到memcached端口
telnet localhost 11211
设置键值
set test 0 0 3
bar
显示
STORED
显示strored即为保存成功
获取键值,输入命令
get test
显示
VALUE test 0 3
bar
使用命令stats查看memcached状态
stats
STAT pid 93852
STAT uptime 2119
STAT time 1489027137
STAT version 1.4.35
STAT libevent 2.1.8-stable
STAT pointer_size 64
STAT rusage_user 0.227149
STAT rusage_system 0.356639
STAT curr_connections 10
STAT total_connections 12
STAT connection_structures 11
STAT reserved_fds 20
STAT cmd_get 2
STAT cmd_set 2
STAT cmd_flush 0
STAT cmd_touch 0
STAT get_hits 2
STAT get_misses 0
STAT get_expired 0
STAT get_flushed 0
STAT delete_misses 0
STAT delete_hits 0
STAT incr_misses 0
STAT incr_hits 0
STAT decr_misses 0
STAT decr_hits 0
STAT cas_misses 0
STAT cas_hits 0
STAT cas_badval 0
STAT touch_hits 0
STAT touch_misses 0
STAT auth_cmds 0
STAT auth_errors 0
STAT bytes_read 115
STAT bytes_written 130
STAT limit_maxbytes 33554432
STAT accepting_conns 1
STAT listen_disabled_num 0
STAT time_in_listen_disabled_us 0
STAT threads 4
STAT conn_yields 0
STAT hash_power_level 16
STAT hash_bytes 524288
STAT hash_is_expanding 0
STAT malloc_fails 0
STAT log_worker_dropped 0
STAT log_worker_written 0
STAT log_watcher_skipped 0
STAT log_watcher_sent 0
STAT bytes 143
STAT curr_items 2
STAT total_items 2
STAT expired_unfetched 0
STAT evicted_unfetched 0
STAT evictions 0
STAT reclaimed 0
STAT crawler_reclaimed 0
STAT crawler_items_checked 0
STAT lrutail_reflocked 0
END
结束telnet,输入telnet退出命令:quit命令退出
quit
显示
Connection closed by foreign host